Back to Devexpress

TdxMessageDialogForm.SetDefaultButton(TMsgDlgBtn) Method

vcl-dxmessagedialog-dot-tdxmessagedialogform-dot-setdefaultbutton-x28-vcl-dot-dialogs-dot-tmsgdlgbtn-x29.md

latest2.3 KB
Original Source

TdxMessageDialogForm.SetDefaultButton(TMsgDlgBtn) Method

Sets the specified button as the default button in the message dialog box.

Declaration

delphi
procedure SetDefaultButton(AButton: TMsgDlgBtn); virtual;

Parameters

NameTypeDescription
AButtonTMsgDlgBtn

The target message dialog button type.

|

Remarks

The default message box button has focus when the message box is invoked.

Code Example: Change the Default Message Box Button

The following code example sets the No button as default:

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 +
    #13#10 + 'Click the [B]Yes[/B] button to increase these margins.';
  ADialog := dxCreateMessageDialog(AMessage, mtWarning, mbYesNoCancel);
  try
    ADialog.SetDefaultButton(mbNo);
    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" +
    "\n" + "Click the [B]Yes[/B] button to increase these margins.";
  ADialog = dxCreateMessageDialog(AMessage, wtWarning, mbYesNoCancel);
  try
  {
    ADialog->SetDefaultButton(mbNo);
    ADialog->ShowModal();
  }
  __finally
  {
    delete ADialog;
  }

See Also

Message Dialog Boxes

BBCode-Inspired Text Formatting Markup

TdxMessageDialogForm Class

TdxMessageDialogForm Members

dxMessageDialog Unit