Skip to main content

Create(TComponent,TMsgDlgType,TMsgDlgButtons,THandle) Constructor

Creates a message dialog box form with support for DevExpress look & feel settings.

Declaration

constructor Create(AOwner: TComponent; AType: TMsgDlgType; AButtons: TMsgDlgButtons; AOwnerWndHandle: THandle = 0); reintroduce; virtual;

Parameters

Name Type Description
AOwner TComponent

The owner form of the message dialog box. Pass a TCustomForm descendant instance as this parameter to center the message box on top of the owner form. You can pass nil (in Delphi) or nullptr (in C++Builder) to center the message box on the screen instead.

AType TMsgDlgType

A message dialog box type that determines the predefined caption, system icon, and sound of the message dialog box.

This parameter value initializes the created form’s DialogType property.

AButtons TMsgDlgButtons

A set of buttons on the message dialog box form.

AOwnerWndHandle THandle

This parameter value initializes the created message box’s Owner property.

The parameter allows dxMessageBox global functions to emulate system MessageBox function behavior.

Remarks

Call this constructor to create a message dialog box form. Use the created form’s Message property to specify the text string you need to display. Call the ShowModal procedure to display the message box.

Code Example: Create and Display a Message Box Dialog

The following code example creates a Warning message box with a formatted message and three standard buttons:

uses dxMessageDialog;
// ...
var
  ADialog: TdxMessageDialogForm;
begin
  ADialog := TdxMessageDialogForm.Create(nil, mtWarning, mbYesNoCancel);
  try
    ADialog.Message := 'One or more margins are set outside the printable area of the page.' + #13#10 +
      #13#10 + 'Click the [B]Yes[/B] button to increase these margins.';
    ADialog.ShowModal;  // Displays the message box as a modal dialog
  finally
    ADialog.Free;  // Releases the message box form when a user closes it
  end;
end;

VCL Editors Library: A Message Dialog Box Example

All Dialog Creation Methods

Create
Creates a message dialog box form with support for DevExpress look & feel settings.
dxCreateMessageDialog

dxCreateMessageDialog(…) | dxCreateMessageDialog(…,ADefaultButton,…)

These functions create a message dialog box with a specified dialog type, message, and a set of buttons.

The second variant allows you to explicitly specify the default button (ADefaultButton).

dxMessageBox

dxMessageBox(…) | dxMessageBox(AOwnerWndHandle,…)

These functions open a message dialog box that displays a specified message, title, and a set of buttons (configured using a combination of flags).

The second variant allows you to associate the message box with an owner window (AOwnerWndHandle).

dxMessageDlg

dxMessageDlg(…) | dxMessageDlg(…,ADefaultButton,…) | dxMessageDlg(…,ATitle,…,ADefaultButton,…)

These functions open a message dialog box with a specified dialog type, message, and a set of buttons.

Second and third variants allow you to explicitly specify the default button (ADefaultButton).

In addition, the third variant allows you to specify the message box title (ATitle).

dxMessageDlgPos

dxMessageDlgPos(…) | dxMessageDlgPos(…ADefaultButton,…) | dxMessageDlgPos(…,ATitle,…,ADefaultButton,…)

These functions open a message dialog box at a specified position on the screen. The message box has a specified dialog type, message, a set of buttons, and an associated help context.

Second and third variants allow you to explicitly specify the default button (ADefaultButton).

In addition, the third variant allows you to specify the message box title (ATitle).

dxMessageDlgPosHelp

dxMessageDlgPosHelp() | dxMessageDlgPosHelp(…ADefaultButton,…) | dxMessageDlgPosHelp(…,ATitle,…,ADefaultButton,…)

These functions open a message dialog box with a help topic supplied in a help file. The message box opens at a specified position on the screen and has a specified dialog type, message, a set of buttons, and an associated help context.

Second and third variants allow you to explicitly specify the default button (ADefaultButton).

In addition, the third variant allows you to specify the message box title (ATitle).

dxShowMessage
Opens a generic message dialog box with an OK button.
dxShowMessageFmt
Opens a generic message dialog box with a formatted message.
dxShowMessagePos
Opens a generic message dialog box at a specified position on the screen.
See Also