Skip to main content
A newer version of this page is available. .

TdxMessageDialogForm.FindButton(TMsgDlgBtn) Method

Provides access to a button by its type.

Declaration

function FindButton(AButton: TMsgDlgBtn): TcxButton;

Parameters

Name Type Description
AButton TMsgDlgBtn

A message box button type.

Returns

Type Description
TcxButton

A DevExpress counterpart of the standard TButton component. If the message box form has no specified button, the FindButton function returns nil (in Delphi) or nullptr/NULL (in C++Builder).

Remarks

Call this function to access and customize individual buttons on the message box form. Then call the AlignButtons procedure to recalculate the layout to fit the custom button content.

The following code example changes captions of the Yes, No, and Cancel buttons:

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);
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;
end;

Custom Button Captions

See Also