Show: Delphi C++
Display Preferences

FMX.Dialogs.MessageDlg

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons; const AHelpContext: THelpContext): Integer;
procedure MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons; const AHelpContext: THelpContext; const ACloseDialogProc: TInputCloseDialogProc);
procedure MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons; const AHelpContext: THelpContext; const ACloseDialogEvent: TInputCloseDialogEvent; const AContext: TObject);
function MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons; const AHelpContext: THelpContext; const ADefaultButton: TMsgDlgBtn): Integer;
procedure MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons; const AHelpContext: THelpContext; const ADefaultButton: TMsgDlgBtn; const ACloseDialogProc: TInputCloseDialogProc);
procedure MessageDlg(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons; const AHelpContext: THelpContext; const ADefaultButton: TMsgDlgBtn; const ACloseDialogEvent: TInputCloseDialogEvent; const AContext: TObject);

C++

extern DELPHI_PACKAGE int __fastcall MessageDlg _DEPRECATED_ATTRIBUTE1("Use FMX.DialogService methods") (const System::UnicodeString AMessage, const System::Uitypes::TMsgDlgType ADialogType, const System::Uitypes::TMsgDlgButtons AButtons, const System::Classes::THelpContext AHelpContext)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
FMX.Dialogs.pas
FMX.Dialogs.hpp
FMX.Dialogs FMX.Dialogs

Description

Warning: MessageDlg is deprecated. Please use Platform.IFMXDialogServiceAsync.MessageDialogAsync.

Displays a custom dialog box.

Use MessageDlg to display a dialog box that is designed according to the function's parameters:

  • AMessage represents the text message of the dialog box.
  • ADialogType represents the type of dialog box.
  • AButtons determines the buttons of the dialog box. The valid combinations of buttons are available as constants in FMX.Dialogs#Constants.
  • AHelpContext specifies the help context ID for the dialog box.
  • ADefaultButton determines the button that is in focus when the dialog box is displayed.
  • ACloseDialogProc is an anonymous method that MessageDlg executes when the dialog box closes.

MessageDlg returns the value of the button that the user selected. If you provide the ACloseQueryProc parameter, InputQuery passes the selected button to the ACloseQueryProc method instead.

The following table lists the possible return values:

TMsgDlgBtn Value Corresponding Return Value

mbOK

mrOk

mbCancel

mrCancel

mbAbort

mrAbort

mbRetry

mrRetry

mbIgnore

mrIgnore

mbYes

mrYes

mbNo

mrNo

mbClose

mrClose

mbHelp

mrHelp

mbTryAgain

mrTryAgain

mbContinue

mrContinue

mbNone

mrNone

mbAll

mrAll

mbNoToAll

mrNoToAll

mbYesToAll

mrYesToAll

Note: The Help button does not return a value because it does not close the dialog. See TCommonDialog.HelpContext.

If a call to MessageDlg does not include the ACloseDialogProc parameter, the call is blocking on all platforms; that is, MessageDlg does not return until the dialog box closes. Android does not support these blocking calls, you can only use MessageDlg on Android if you provide the ACloseDialogProc parameter.

Calls to MessageDlg that include the ACloseDialogProc parameter are also blocking on desktop platforms but they are non-blocking on mobile platforms; that is, on mobile platforms any code that you place after a call to MessageDlg is executed before the dialog box closes. If you need to execute code after your dialog box closes, use the ACloseDialogProc parameter of MessageDlg to define an anonymous method that runs that code. See:

Platform Support

The following table summarizes which platforms support which calls to MessageDlg and whether those calls are blocking or non-blocking:

Platform Without ACloseDialogProc With ACloseDialogProc
Windows Blocking Blocking
OS X Blocking Blocking
iOS Blocking Non-blocking
Android Non-blocking

See Also

Code Examples

Personal tools
In Other Languages
Previous Versions
Assistance