Applies to

CommandButton, PictureButton, OLECustomControl controls


The Default property specifies that the control is the default button. If Default is true, the selected control has a thick border and receives a Clicked event when the user presses Enter (unless the user has tabbed to another control). If Default is false, the control is not the default and pressing Enter does not affect it unless the user tabs to it.

Setting focus

If the window contains an editable field, such as a MultiLineEdit, then the default button behaves as expected (receives the Clicked event when the user presses Enter) when focus is on the editable field. When the user presses Tab to move focus to another button (not the default), pressing Enter fires the Clicked event for the button that currently has focus.

If the window does not contain an editable field, use SetFocus or tab order to make sure the default button behaves as documented above.

You can make a CommandButton, PictureButton, or OLECustomControl control the default button so that it responds to the Enter key. If you check Default for more than one control, the last one set acts as the default.


In a painter

To enable the Default property

  • Select the Default check box on the General page of the control's Properties view.

In scripts

The Default property takes a boolean value. To set a PictureButton as the default button, use a line like the following:

pb_1.Default = TRUE