• Delphi XE MessageDlg[3] 返回判定与处理


    Delphi XE MessageDlg[3] 返回判定与处理

    //滔Roy 2022.09.30
    procedure THeaderFooterForm.MDlgResult1(Sender: TObject;const AResult:TModalResult);
    begin
      if AResult=mrYes then
        ShowMessage('yes3')
       else if AResult=mrNo then
        ShowMessage('No3');
    end;
    
    procedure THeaderFooterForm.Button3Click(Sender: TObject);
    begin
      {function MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
                           const AHelpContext: THelpContext): Integer;  }
      if MessageDlg('测试 mbYesNo返回1.', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0)=mrYes then begin
        MessageDlg('点击了yes1.', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOk], 0);
      end;
    
      {procedure MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
                            const AHelpContext: THelpContext; const ACloseDialogProc: TInputCloseDialogProc);}
      MessageDlg('测试 mbYesNo返回2.', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0,
        procedure(const AResult:TModalResult)
        begin
           if AResult=mrYes then
            ShowMessage('yes2')
           else if AResult=mrNo then
            ShowMessage('No2');
        end
      );
    
      {procedure MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
                            const AHelpContext: THelpContext; const ACloseDialogEvent: TInputCloseDialogEvent; const AContext: TObject);}
                            //可以指定对象,以及触发指定对象中的方法
      MessageDlg('测试 mbYesNo返回3.', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0,MDlgResult1,HeaderFooterForm);
    
    
      {function MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
                            const AHelpContext: THelpContext; const ADefaultButton: TMsgDlgBtn): Integer;//默认按钮 }
      if MessageDlg('测试 mbYesNo返回4.', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0, TMsgDlgBtn.mbNo)=mrYes then begin
        MessageDlg('点击了yes4.', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOk], 0);
      end;
    
      {procedure MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
                            const AHelpContext: THelpContext; const ADefaultButton: TMsgDlgBtn;const ACloseDialogProc: TInputCloseDialogProc);}
      //默认按钮+ ACloseDialogProc 事件
      MessageDlg('测试 mbYesNo返回5.', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0, TMsgDlgBtn.mbNo,
        procedure(const AResult:TModalResult)
        begin
           if AResult=mrYes then
            ShowMessage('yes5')
           else if AResult=mrNo then
            ShowMessage('No5');
        end
      );
    
      {procedure MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
                            const AHelpContext: THelpContext; const ADefaultButton: TMsgDlgBtn;const ACloseDialogEvent: TInputCloseDialogEvent;
                            const AContext: TObject); }
      //只是在测试3的基础上加了默认按钮
      MessageDlg('测试 mbYesNo返回6.', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0, TMsgDlgBtn.mbNo,MDlgResult1,HeaderFooterForm);
    
    
      {
      TInputCloseDialogProc = reference to procedure(const AResult: TModalResult);
      TInputCloseDialogEvent = procedure(Sender: TObject; const AResult: TModalResult) of object;
      }
    
    end;
    

      

      

    创建时间:2022.09.30  更新时间:

  • 相关阅读:
    Python脚本模拟登陆DVWA
    PHP单元测试使用
    PHPUnit实践一(初识)
    composer引用本地git做为源库
    编写自己的composer项目
    Laravel 核心--Facades 门面
    Laravel5 创建自定义门面(Facade)
    简单理解laravel框架中的服务容器,服务提供者以及怎样调用服务
    Laravel自带SMTP邮件组件实现发送邮件(QQ、163、企业邮箱都可)
    cocos2d-x游戏开发系列教程-坦克大战游戏之坦克和地图碰撞的检测下
  • 原文地址:https://www.cnblogs.com/guorongtao/p/16743756.html
Copyright © 2020-2023  润新知