Skip to main content

dxMessageBox(string,string,Integer) Method

Invokes a modal message dialog box.

Declaration

function dxMessageBox(const AMessage: string; const ATitle: string; AFlags: Integer): Integer;

Parameters

Name Type Description
AMessage string

Message dialog box content. The AMessage parameter value initializes the created form’s Message property.

The AMessage parameter supports a set of BBCode-inspired tags that allow you to format message box content. Refer to the Remarks section for the full list of supported formatting tags.

ATitle string

A message dialog box caption. You can pass an empty string as the ATitle parameter to display the predefined “Error” caption.

AFlags Integer

A combination of flags that define available UI elements and message dialog box behavior.

Refer to the list of supported flags in the Remarks section.

Returns

Type Description
Integer

An integer value that indicates the button clicked to close the message box.

The dxMessageBox function returns 0 if it fails to invoke a message box.

Refer to the list of possible return values in the Remarks section.

Remarks

Call the dxMessageBox function to invoke a generic dialog box with a message and one or more buttons. The created message dialog box has the mdsMessageBox style.

Supported BBCode-Inspired Markup Tags

Text Formatting Attribute Message Text with Tags Example
Bold '[B]DevExpress[/B]' VCL Editors Library: A Bold Font Attribute Example
Italic '[I]DevExpress[/I]' VCL Editors Library: An Italic Font Attribute Example
Underscore '[U]DevExpress[/U]' VCL Editors Library: An Underscore Font Attribute Example
Strikeout '[S]DevExpress[/S]' VCL Editors Library: A Strikeout Font Attribute Example
Subscript 'Dev[Sub]Express[/Sub]' VCL Editors Library: A Subscript Font Attribute Example
Superscript 'Dev[Sup]Express[/Sup]' VCL Editors Library: A Superscript Font Attribute Example
Custom Font 'Dev[U][Font=Consolas][Size=12]Express[/U][/Font][/Size]' VCL Editors Library: A Custom Font Settings Example
Color '[Color=#E67E22]Dev[/Color][Color=Gray]Express[/Color]' VCL Editors Library: A Color Font Attribute Example
Background Color '[BackColor=Orange]DevExpress[/BackColor]' VCL Editors Library: A Background Color Font Attribute Example
Hyperlink '[URL=http://www.devexpress.com/]DevExpress[/URL]' VCL Editors Library: A Hyperlink Example
No Parse '[NOPARSE][B]DevExpress[/B][/NOPARSE]' VCL Editors Library: A "No Parse" Example

Code Example

The following code example displays a message box with the predefined “Error” caption, an OK button, and an error icon:

uses dxMessageDialog;
// ...
  dxMessageBox('Invalid operation!', '', MB_OK or MB_ICONERROR);

VCL Editors Library: A Skinned Message Box Example

Supported Flags

MB_OK
The message box has only the OK button.
MB_RETRYCANCEL
The message box has two buttons: Retry and Cancel.
MB_YESNO
The message box has two buttons: Yes and No.
MB_YESNOCANCEL
The message box has three buttons: Yes, No, and Cancel.
MB_ABORTRETRYIGNORE
The message box has three buttons: Abort, Retry, and Ignore.
MB_OKCANCEL
The message box has two buttons: OK and Cancel.
MB_DEFBUTTON1
Explicitly defines the first button as default. The first button is default unless the MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 flag is set.
MB_DEFBUTTON2
Sets the second button as default.
MB_DEFBUTTON3
Sets the third button as default.
MB_DEFBUTTON4
Sets the fourth button as default.
MB_ICONWARNING or MB_ICONEXCLAMATION
The message box displays an exclamation sign icon.
MB_ICONERROR, MB_ICONHAND, or MB_ICONSTOP
The message box displays a stop sign button.
MB_ICONINFORMATION or MB_ICONASTERISK
The message box displays the icon that consists of a lowercase i in a circle.
MB_ICONQUESTION
The message box displays a question sign icon.
MB_RTLREADING
The message box changes the direction of message and caption text to right-to-left.
MB_TOPMOST
The message box has the WS_EX_TOPMOST window style.

Returned Values

IDOK
A user clicked the OK button to close the message box.
IDCANCEL
A user clicked the Cancel button to close the message box.
IDABORT
A user clicked the Abort button to close the message box.
IDRETRY
A user clicked the Retry button to close the message box.
IDIGNORE
A user clicked the Ignore button to close the message box.
IDYES
A user clicked the Yes button to close the message box.
IDNO
A user clicked the No button to close the message box.
See Also