MessageDlg() enables you to display system dialog based on various dialog type as well as system buttons, |
function MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer; function MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultButton: TMsgDlgBtn): Integer; overload; |
Value | Meaning |
---|---|
| Warns the user about a potential issue. |
| Informs the user of an error that occurred. |
| Provides information to the user. |
| Ask the user for confirmation. |
| None of the above. |
TMsgDlgBtn Value | Corresponding return value |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uses Dialogs; procedure TForm1.Button1Click(Sender: TObject); begin if Dialogs.MessageDlg('Welcome to my Delphi application. Exit now?', mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then begin Dialogs.MessageDlg('Exiting the Delphi application.', mtInformation, [mbOk], 0, mbOk); Close; end; end; |
uses Dialogs; procedure TForm1.Button1Click(Sender: TObject); begin if Dialogs.MessageDlg('Welcome to my Delphi application. Exit now?', mtWarning, [mbYes, mbNo], 0, mbYes) = mrYes then begin Dialogs.MessageDlg('Exiting the Delphi application.', mtInformation, [mbOk], 0, mbOk); Close; end; end; |