Vcl.Dialogs.MessageDlg

From RAD Studio API Documentation
Jump to: navigation, search

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;

C++

extern DELPHI_PACKAGE int __fastcall MessageDlg(const System::UnicodeString Msg, System::Uitypes::TMsgDlgType DlgType, System::Uitypes::TMsgDlgButtons Buttons, int HelpCtx)/* overload */;

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

mbOK

mrOk

mbCancel

mrCancel

mbYes

mrYes

mbNo

mrNo

mbAbort

mrAbort

mbRetry

mrRetry

mbIgnore

mrIgnore

mbAll

mrAll

mbNoToAll

mrNoToAll

mbYesToAll

mrYesToAll

mbClose

mrClose

Note: If the user types CTRL+C in the message box, the text of the message is copied to the clipboard.

See Also

Code Examples