dxCreateMessageDialog(string,TMsgDlgType,TMsgDlgButtons,TMsgDlgBtn) Method
Creates a message dialog box form with specified settings.
Declaration
function dxCreateMessageDialog(const AMessage: string; ADialogType: TMsgDlgType; AButtons: TMsgDlgButtons; ADefaultButton: TMsgDlgBtn): TdxMessageDialogForm;
Parameters
Name | Type | Description |
---|---|---|
AMessage | string | Message dialog box content. The The |
ADialogType | TMsgDlgType | A message dialog box type that determines the predefined caption, system icon, and sound of the message dialog box. |
AButtons | TMsgDlgButtons | A set of buttons on the message dialog box form. |
ADefaultButton | TMsgDlgBtn | A button type. Use this parameter to specify the button that has focus when the message box appears. |
Returns
Type | Description |
---|---|
TdxMessageDialogForm | The created message dialog box form. |
Remarks
You can call the dxCreateMessageDialog
function instead of the TdxMessageDialogForm constructor. The created message dialog box has the mdsMessageDlg style.
Supported BBCode-Inspired Markup Tags
Text Formatting Attribute | Message Text with Tags | Example |
---|---|---|
Bold | '[B]DevExpress[/B]' |
|
Italic | '[I]DevExpress[/I]' |
|
Underscore | '[U]DevExpress[/U]' |
|
Strikeout | '[S]DevExpress[/S]' |
|
Subscript | 'Dev[Sub]Express[/Sub]' |
|
Superscript | 'Dev[Sup]Express[/Sup]' |
|
Custom Font | 'Dev[U][Font=Consolas][Size=12]Express[/U][/Font][/Size]' |
|
Color | '[Color=#E67E22]Dev[/Color][Color=Gray]Express[/Color]' |
|
Background Color | '[BackColor=Orange]DevExpress[/BackColor]' |
|
Hyperlink | '[URL=http://www.devexpress.com/]DevExpress[/URL]' |
|
No Parse | '[NOPARSE][B]DevExpress[/B][/NOPARSE]' |
Code Example
The following code example calls the dxCreateMessageDialog
function to create a message box with Yes, No, and Cancel buttons, customizes their captions, and moves focus to the Cancel button:
uses dxMessageDialog;
// ...
var
ADialog: TdxMessageDialogForm;
AMessage: string;
begin
AMessage := 'One or more margins are set outside the printable area of the page.' + #13#10 +
'Choose the [B]Fix[/B] button to increase the appropriate margins.';
ADialog := dxCreateMessageDialog(AMessage, mtWarning, mbYesNoCancel, mbCancel);
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; // Invokes the form as a modal dialog
finally
ADialog.Free; // Releases the message box form once a user closes it
end;
Limitation
The dxUseStandardMessageDialogs global variable has no effect on dxCreateMessageDialog
function calls.