加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – 为什么MessageDlg在windows下只显示“OK”按钮?

发布时间:2020-12-15 04:10:56 所属栏目:大数据 来源:网络整理
导读:使用delphi 10.2.2 firemonkey,在 windows下,当我这样做时: MessageDlg('Are you sure you want to undo the last operation ?',// const AMessage: string; TMsgDlgType.mtConfirmation,// const ADialogType: TMsgDlgType; [TMsgDlgBtn.mbYes,TMsgDlgBtn.
使用delphi 10.2.2 firemonkey,在 windows下,当我这样做时:
MessageDlg('Are you sure you want to undo the last operation ?',// const AMessage: string;
             TMsgDlgType.mtConfirmation,// const ADialogType: TMsgDlgType;
             [TMsgDlgBtn.mbYes,TMsgDlgBtn.mbCancel],// const AButtons: TMsgDlgButtons;
             0,// const AHelpContext: THelpContext;
             TMsgDlgBtn.mbCancel,// const ADefaultButton: TMsgDlgBtn;
             procedure(const AResult: TModalResult)
             begin
               if AResult = mrYes then begin
               end;
             end); // const ACloseDialogProc: TInputCloseDialogProc);

然后在弹出对话框中只显示一个“OK”按钮(没有“取消”也没有“是”).这是正常还是我错过了什么?

解决方法

这是因为Delphi检查有效的按钮组合,并且对于Yes和Cancel的组合,Windows平台上没有相应的 dialog box type.您只需使用“确定”按钮进行对话,因为传递给Windows API函数的结构在开头归零,而uType参数MB_OK的值仅为0.

Windows的实现位于FMX.Dialogs.Win模块内的TFMXDialogService.MessageDialog方法内.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读