Message Dialog Boxes
- 7 minutes to read
A message box is a modal dialog designed to display important information and optionally allow a user to make a choice or confirm an operation. All DevExpress products use the TdxMessageDialogForm class to display message dialog boxes that support skins and BBCode-inspired markup tags:

Create a Skinnable Message Box
Skinnable DevExpress message dialog boxes allow you to ensure app appearance consistency. These message boxes import global skin and palette settings defined using the TdxSkinController component or the Project Settings dialog.
DevExpress Message Box Creation Methods and Standard VCL Counterparts
All message box creation methods shipped as part of the DevExpress VCL components are API-compatible with corresponding standard counterparts available in the VCL library installed with the Embarcadero RAD Studio IDE. The dxMessageDialog unit declares all DevExpress message box creation methods listed in the following table:
| DevExpress Method | Standard VCL Method | Description |
|---|---|---|
| dxCreateMessageDialog | CreateMessageDialog | Creates a message dialog box with a specified dialog type and message. Allows you to specify a set of buttons and move focus to one of the buttons. |
| dxMessageBox | TApplication.MessageBox | Opens a message dialog box that displays a specified message, title, and buttons (configured using a combination of flags). Allows you to associate the message box with an owner window. |
| dxMessageDlg | MessageDlg | Opens a message dialog box with a specified dialog type, message, and a set of buttons. |
| dxMessageDlgPos | MessageDlgPos | Opens a message dialog box at a specified position on the screen. Allows you to specify the default button. |
| dxMessageDlgPosHelp | MessageDlgPosHelp | Opens a message dialog box associated with a help topic and positions the dialog box at specific screen coordinates. |
| dxShowMessage | ShowMessage | Opens a generic message dialog box with an OK button. |
| dxShowMessageFmt | ShowMessageFmt | Opens a generic message dialog box with a formatted message and an OK button. |
| dxShowMessagePos | ShowMessagePos | Opens a generic message dialog box at a specified position on the screen. |
Optional BBCode Markup-Related Parameters
DevExpress message box creation methods are API-compatible with corresponding standard methods available in the VCL library. In addition to the same parameters available in standard methods, all DevExpress methods allow you to specify the following optional parameters associated with hyperlink and hint-related behavior:
AHyperlinkClickProcSpecifies a click handler that allows you to identify the clicked hyperlink and prevent certain links from being activated.
Refer to the TdxMessageDialogHyperlinkClickDelegate procedural type description for detailed information and a code example.
AShowHyperlinkHintProcSpecifies a hyperlink hint handler that allows you to change the predefined hint message (the hyperlink target URI) depending on certain conditions in your application.
Refer to the TdxMessageDialogShowHyperlinkHintDelegate procedural type description for detailed information and a code example.
AHintedTextClickProcSpecifies a handler routine that allows you to execute custom commands in response to a click on a text range enclosed between
[HINT]and[/HINT]markup tags.Refer to the TdxMessageDialogHintedTextClickDelegate procedural type description for detailed information and a code example.
AShowTextHintProcSpecifies a hint display handler for a text range enclosed between
[HINT]and[/HINT]tags. For example, you can use this handler to modify the current hint message depending on certain conditions in your application.Refer to the TdxMessageDialogShowTextHintDelegate procedural type description for detailed information and a code example.
Global DevExpress Message Box Usage Flag
All DevExpress controls and components call these global methods to display message boxes. If you call DevExpress methods to open message boxes, you can use the global dxUseStandardMessageDialogs global variable to switch between skinnable DevExpress (default) and standard message boxes.
Message Box Content Formatting
All message box creation methods allow you to pass the required message as a parameter. Once a message dialog box form is created, you can use its Message property to change the displayed message.
Captions in multiple DevExpress controls can use Bulletin Board Code (BBCode) markup tags. These tags allow you to define hints, hyperlinks, and text formatting, such as font family, size, style, and color.
dxMessageBox('Read the [URL=https://www.devexpress.com/VCL]DevExpress VCL Documentation[/URL]',
'Note', MB_OK or MB_ICONINFORMATION);

Refer to the following topic for detailed information on all available formatting options: BBCode-Inspired Text Formatting Markup.
Customize Dialog Buttons
The TdxMessageDialogForm includes one or more TcxButton components to display message box buttons. You can use the TdxMessageDialogForm.Buttons property or call the TdxMessageDialogForm.FindButton function to change predefined button captions before the form is displayed. The following code example changes captions of Yes, No, and Cancel buttons:
uses dxMessageDialog;
// ...
var
ADialog: TdxMessageDialogForm;
AMessage: string;
begin
AMessage := 'One or more margins are set outside the printable area of the page.' + #13#10 +
#13#10 + 'Click the [B]Fix[/B] button to increase these margins.';
ADialog := dxCreateMessageDialog(AMessage, mtWarning, mbYesNoCancel);
try
ADialog.FindButton(mbYes).Caption := 'Fix';
ADialog.FindButton(mbNo).Caption := 'Restore Original';
ADialog.FindButton(mbCancel).Caption := 'Close';
ADialog.AlignButtons; // Recalculates the button layout
ADialog.ShowModal; // Displays the message box form as a modal dialog
finally
ADialog.Free; // Releases the message box form when a user closes it
end;
end;

Customize the Message Box Layout
The message dialog box form has multiple layout customization options:
Change the UseLatestCommonDialogs Global Variable
Set the UseLatestCommonDialogs global variable to True or False to switch between two predefined layouts also available for standard VCL message boxes:
| Value | Description | Example |
|---|---|---|
True (Default) |
The modern message box style available in Microsoft Windows® Vista and newer operating systems. The message box has a fixed width; buttons are right-aligned. | ![]() |
False |
The message box style found in Microsoft Windows® XP and older operating systems. The width of the message box depends on its content size; buttons are centered. | ![]() |
Use the TdxMessageDialogForm.Style Property
You can set the form’s Style property to mdsMessageBox or mdsMessageDlg to switch between two layout styles that imitate message boxes you can create using standard VCL library methods:
| Value | Description | Example |
|---|---|---|
mdsMessageDlg (default) |
This message dialog style imitates dialogs that are displayed by the standard MessageDlg function. The message box layout has increased paddings between borders and the message icon. | ![]() |
mdsMessageBox |
This message box style imitates dialog boxes that are displayed by the standard MessageBox function. The message box layout is smaller than the message dialog style (mdsMessageDlg). | ![]() |
Limitations & Considerations
This layout customization option is available only before you manually display a skinnable message dialog box form after you call the dxCreateMessageDialog function or the form constructor.
Create a Custom Message Dialog Box Form
You can replace the built-in message dialog box form with a custom implementation:
- Derive a custom form from the TdxMessageDialogForm class.
- Assign a reference to your form class to the dxMessageDialogFormClass global variable.



