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 box. The DialogType property returns this parameter value for any message box form.

AButtons TMsgDlgButtons

A set of buttons on the message dialog box form.

AOwnerWndHandle THandle

A handle to the owner window of the message box.

dxMessageBox global functions use this parameter to emulate the system MessageBox function behavior.

Use the AOwner parameter if you need to specify the owner window for the created message box.

Remarks

Call this constructor to create a message dialog box form. Then, use the 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

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;  // Invokes 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

Alternative Dialog Creation Methods

dxCreateMessageDialog
Creates a message dialog box form with the specified settings.
dxMessageBox
Invokes a modal message dialog box.
dxMessageDlg
Invokes a modal message dialog box.
dxMessageDlgPos
Invokes a modal message dialog box at the specified position on the screen.
dxMessageDlgPosHelp
Invokes a message dialog box whose help topic is supplied in a specified help file.
dxShowMessage
Invokes a generic message dialog box with an OK button.
dxShowMessageFmt
Displays a message dialog box with a formatted message.
dxShowMessagePos
Invokes the message dialog box at the specified position on the screen.
See Also