Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

Buttons property

Project: Message Dialogue Components.

Unit: PJMessageDialog.

Class: TPJVCLMsgDlg

Applies to: ~>3.0

type
  TMsgDlgButton = (
    mbYes, mbNo, mbOK, mbCancel, mbAbort, mbRetry, mbIgnore,
    mbAll, mbNoToAll, mbYesToAll, mbHelp, mbClose
  );

type TMsgDlgButtons = set of TMsgDlgBtn;

property Buttons: TMsgDlgButtons;

Description

The Buttons property records the set of buttons that are to appear in the dialogue box. This property is more flexible that the related ButtonGroup property - it supports additional buttons in any combination.

Setting the Buttons property causes ButtonGroup to be updated. If the combination of buttons required is not supported by the ButtonGroup property, that property is set to bgUnknown. Conversely setting the ButtonGroup property causes the Buttons property to be updated to the set of buttons in the selected group.

Note: Normally, setting Buttons to a set of buttons supported by ButtonGroup and then including mbHelp in Buttons will cause ButtonGroup to revert to bgUnknown. To prevent this include mdoGroupIgnoresHelp in the Options property. When this option is included mbHelp is ignored when trying to match Buttons to a valid button group.

Because of the link between Buttons and ButtonGroup and its linkage with DlgType, setting Buttons can affect the value of DlgType and vice versa.

The set of available buttons (TMsgDlgButtons) is defined in the Dialogs unit and is as follows:

Value Button caption ModalResult
mbYes “Yes” mrYes
mbNo “No” mrNo
mbOK “OK” mrOK
mbCancel “Cancel” mrCancel
mbAbort “Abort” mrAbort
mbRetry “Retry” mrRetry
mbIgnore “Ignore” mrIgnore
mbAll “All” mrAll
mbNoToAll “No To All” mrNoToAll
mbYesToAll “Yes To All” mrYesToAll
mbHelp “Help” N/a (doesn’t close dialogue)
mbClose “Close” mrClose

Note that if the Options property includes mdoAutoHelpBtn then the display of a help button depends only on the value of the HelpContext property - inclusion of mbHelp in the Buttons property is ignored.

Similarly if mdoInhibitCancel is included in Options a cancel button will never be displayed, regardless of whether mbCancel is included in Buttons.

Which button in the Buttons set is to be the default button is specified by the DefButton property.

Note that if no buttons are specified for display, or if all the buttons specified in the Buttons property are inhibited by Options settings, then the dialogue will display an OK button. The Help button is ignored when determining the above since it does not close the dialogue, i.e. if only the Help button would be displayed then an OK button is also included.

The default value of the property is [mbOK].