Vcl.Dialogs.TaskMessageDlg

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function TaskMessageDlg(const Title, Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
function TaskMessageDlg(const Title, Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultButton: TMsgDlgBtn): Integer; overload;
function TaskMessageDlg(const Title, Msg: string; DlgType: TMsgDlgType;
Buttons: TMsgDlgButtons; HelpCtx: Longint; DefaultButton: TMsgDlgBtn; CustomButtonCaptions: array of string): Integer; overload;

C++

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

Properties

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

Description

Displays a message task dialog box in the center of the screen.

Call TaskMessageDlg to bring up a message box and obtain the user's response.

Caption specifies the caption for the message box when DlgType is mtCustom. If this parameter is not used, the caption for custom message boxes is the title of the application.

Msg is the content of the message that appears.

DlgType indicates the purpose of the dialog:



DlgType Value Meaning

mtWarning

A message box containing a yellow exclamation point symbol.

mtError

A message box containing a red stop sign.

mtInformation

A message box containing a blue "i".

mtConfirmation

A message box containing a green question mark.

mtCustom

A message box containing no bitmap. The caption of the message box is the name of the application's executable file.



Buttons indicates what buttons should appear in the message box. For a three button message box, use the syntax containing Button1, Button2, and Button3.

Button1, Button2, and Button3 indicate what types of buttons to use for a three button message box. The resulting buttons appear in order.

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.

X and Y specify the screen coordinates where the dialog should appear. A value of –1 means that the message box can appear anywhere in the specified dimension.

DefaultBtn specifies which button from among those specified by Buttons (or Button1, Button2, and Button3) is the default button for the dialog. If DefaultBtn is mbNone, there is no default button.

Bitmap is an image that appears on the face of the message dialog. If Bitmap is nil (Delphi) or NULL (C++), there is no image unless DlgType is mtConfirmation.

MessageDlg returns the value of the button the user selected. The following table lists the TMsgDlgBtn 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

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