1、在{$mode objfpc}{$H+} 后加
{$ModeSwitch ANONYMOUSFUNCTIONS}

2、例子

Application.QueueAsyncCall(procedure (Data:PtrInt) var i:Integer; begin i:=1;i:=2 end,0); 

linux下对UI操作最好都用这个

3、传参数

type
TLogMsgData = record 
Text: string;
end;
PLogMsgData = ^TLogMsgData;

---------------------------------------------------------------------------

var
LogMsgToSend: PLogMsgData;
begin
New(LogMsgToSend);
LogMsgToSend^.Text:= AMsg;
Application.QueueAsyncCall(procedure (Data:PtrInt)

var

ReceivedLogMsg: TLogMsgData;

begin

 

ReceivedLogMsg := PLogMsgData(Data)^;

//处理程序

end, PtrInt(LogMsgToSend));

posted on 2024-01-04 09:50  禁卫军  阅读(46)  评论(0编辑  收藏  举报