TdxMessageDialogForm.FindButton(TMsgDlgBtn) Method
#Declaration
function FindButton(AButton: TMsgDlgBtn): TcxButton;
#Parameters
Name | Type | Description |
---|---|---|
AButton | TMsg |
The target message box button type. |
#Returns
Type | Description |
---|---|
Tcx |
A DevExpress counterpart of the standard TButton component. If the message box form has no specified button, the |
#Remarks
Call the FindButton
function to access and customize individual buttons on the message box form. Then call the AlignButtons procedure to recalculate the layout to fit custom button content.
#Code Example: Define Custom Button Captions in a Message Box
The following code example changes captions of Yes, No, and Cancel buttons:
uses dxMessageDialog;
// ...
var
ADialog: TdxMessageDialogForm;
AMessage: string;
begin
AMessage := 'One or more margins are set outside the printable area of the page.' + #13#10 +
#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; // Recalculates the button layout
ADialog.ShowModal; // Invokes the form as a modal dialog
finally
ADialog.Free; // Releases the message box form when a user closes it
end;
end;