[FMX] PostMessage 更新:增加了对匿名函数的支持

来源:转载

关于 FMX 下 PostMessage 的实现的相关说明参考: 在FMX中实现PostMessage的方法一文。新版本增加了匿名函数的支持,也就是说,你Post的消息可以直接用匿名函数响应了,其匿名函数版本声明如下:

Delphi/Pascal

TPostProcedureA = reference to procedure(ASender: TObject; AMsgId: Integer;AWParam, ALParam: NativeInt); TPostProcedureA=referencetoprocedure(ASender:TObject;AMsgId:Integer;AWParam,ALParam:NativeInt);

调用示例:

Delphi/Pascal

procedure TForm5.Button3Click(Sender: TObject);beginPostMessage( procedure (ASender:TObject;AMsgId:Integer;AWParam,ALParam:NativeInt) begin ShowMessage('Button3 Clicked'); end,Self,3,0,0);end; procedureTForm5.Button3Click(Sender:TObject);beginPostMessage( procedure(ASender:TObject;AMsgId:Integer;AWParam,ALParam:NativeInt) begin ShowMessage('Button3 Clicked'); end,Self,3,0,0);end;

下载链接: 百度云



分享给朋友:
您可能感兴趣的文章:
随机阅读: