Delphi XE MessageDialogAsync 和 MessageDialogSync [2] - 用法示例
Delphi XE MessageDialogAsync 和 MessageDialogSync [2] - 用法示例
1、MessageDialogAsync
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | //滔Roy 2022.09.30 uses FMX . Platform; // IFMXDialogServiceAsync ,MessageDialogAsync //MessageDialogAsync var IDiaSerAsync:IFMXDialogServiceAsync; begin if TPlatformServices . Current . SupportsPlatformService (IFMXDialogServiceAsync, IInterface(IDiaSerAsync)) then begin //这里的顺序有点要注意,和 MessageDlg 的不同,默认按钮在帮助之前 //MessageDialogAsync - 异步工作,调用立即完成,它们不会等待用户关闭对话框。 IDiaSerAsync . MessageDialogAsync( '测试 对话框 异步.' , TMsgDlgType . mtInformation, [TMsgDlgBtn . mbYes, TMsgDlgBtn . mbNo], TMsgDlgBtn . mbYes, 0 , procedure ( const AResult:TModalResult) begin if AResult=mrYes then ShowMessage( 'yes 对话框 异步' ) else if AResult=mrNo then ShowMessage( 'No 对话框 异步' ); end ); end ; end ; |
2、MessageDialogSync
1 2 3 4 5 6 7 8 9 10 11 12 13 | //MessageDialogSync var IDiaSerSync:IFMXDialogServiceSync; begin if TPlatformServices . Current . SupportsPlatformService (IFMXDialogServiceSync, IInterface(IDiaSerSync)) then begin //这里的顺序有点要注意,和 MessageDlg 的不同,默认按钮在帮助之前 // MessageDialogSync - 同步工作。只有当用户关闭对话框时,才会完成对调用。 if IDiaSerSync . MessageDialogSync( '测试 对话框 同步.' , TMsgDlgType . mtInformation, [TMsgDlgBtn . mbYes, TMsgDlgBtn . mbNo], TMsgDlgBtn . mbYes, 0 )=mrYes then begin ShowMessage( 'yes 对话框 同步' ) end else ShowMessage( 'No 对话框 同步' ); end ; |
创建时间:2022.09.30 更新时间:
博客园 滔Roy https://www.cnblogs.com/guorongtao 希望内容对你有所帮助,谢谢!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报