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  更新时间:

posted on   滔Roy  阅读(175)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报

导航

点击右上角即可分享
微信分享提示