Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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:

VCL Editors Library: Before Layout Recalculation

#Code Example: Define Custom Button Captions

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

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;

VCL Editors Library: Custom Button Captions

See Also