Vcl.Dialogs.MessageDlg
Delphi
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;
function MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultButton: TMsgDlgBtn; CustomButtonCaptions: array of string): Integer; overload;
C++
extern DELPHI_PACKAGE int __fastcall MessageDlg(const System::UnicodeString Msg, System::Uitypes::TMsgDlgType DlgType, System::Uitypes::TMsgDlgButtons Buttons, int HelpCtx)/* overload */;
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | Vcl.Dialogs.pas Vcl.Dialogs.hpp |
Vcl.Dialogs | Vcl.Dialogs |
Description
Displays a message dialog box in the center of the screen.
Call MessageDlg to bring up a message box and obtain the user's response.
Msg
is the content of the message that appears.
DlgType
indicates the purpose of the dialog.
Buttons
is a set of buttons and indicates what buttons should appear in the message box. The buttons appear in the same order they appear in the Buttons set.
HelpCtx
specifies the context ID for the Help topic that should appear when the user clicks the Help button or presses F1 while the dialog is displayed.
DefaultBtn
specifies which button from among those specified by Buttons
is the default button (focused button) for the dialog.
MessageDlg returns the value of the button the user selected.
See the table on the Vcl.Dialogs.TMsgDlgButtons page for values for each type of button that can appear in the message box, and the corresponding value that is returned if the user selects that button.
TMsgDlgBtn Value | Corresponding return value |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: If the user types CTRL+C in the message box, the text of the message is copied to the clipboard.
Having mtConfirmation
Show a Question Mark
Dialog boxes of TMsgDlgType.mtConfirmation type show an information icon.
In the past, they used to show a question mark instead, but Microsoft removed the question mark symbol from the Windows API function that the VCL uses to display TMsgDlgType.mtConfirmation
dialog boxes. Quoting Microsoft:
- "The question-mark message icon is no longer recommended because it does not clearly represent a specific type of message and because the phrasing of a message as a question could apply to any message type. In addition, users can confuse the message symbol question mark with Help information."
To use the previous dialog box appearance, you must set the UseLatestCommonDialogs
variable of the Vcl.Dialogs unit to False
.
See Also
- FMX.Platform.IFMXDialogServiceSync.MessageDialogSync
- FMX.Platform.IFMXDialogServiceAsync.MessageDialogAsync