Back to Devexpress

TdxMessageDialogForm.AlignButtons Method

vcl-dxmessagedialog-dot-tdxmessagedialogform-de1e1fe7.md

latest2.4 KB
Original Source

TdxMessageDialogForm.AlignButtons Method

Calculates optimal dimensions and positions of customized buttons.

Declaration

delphi
procedure AlignButtons; virtual;

Remarks

Custom captions may be too long to fit into buttons with predefined dimensions:

Code Example: Define Custom Button Captions

Call the AlignButtons procedure to recalculate the form layout after button customization:

delphi
uses dxMessageDialog;
// ...
var
  ADialog: TdxMessageDialogForm;
  AMessage: string;
begin
  AMessage := 'One or more margins are set outside the printable area of the page.' + #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;
    ADialog.ShowModal;
  finally
    ADialog.Free;
  end;
end;
cpp
#include "dxMessageDialog.hpp"
// ...
  TdxMessageDialogForm *ADialog;
  UnicodeString AMessage = "One or more margins are set outside the printable area of the page.\n" +
    "Click the [B]Fix[/B] button to increase these margins.";
  ADialog = dxCreateMessageDialog(AMessage, wtWarning, mbYesNoCancel);
  try
  {
    ADialog->FindButton(mbYes)->Caption = "Fix";
    ADialog->FindButton(mbNo)->Caption = "Restore Original";
    ADialog->FindButton(mbCancel)->Caption = "Close";

    ADialog->AlignButtons();
    ADialog->ShowModal();
  }
  __finally
  {
    delete ADialog;
  }

See Also

Message Dialog Boxes

BBCode-Inspired Text Formatting Markup

TdxMessageDialogForm Class

TdxMessageDialogForm Members

dxMessageDialog Unit