Name: default

Type: property

Syntax: set the default of <button> to {true | false}

Summary: Specifies that a <button> will be automatically chosen when the user presses Return or Enter.

Associations: button

Introduced: 1.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Example:
set the default of button "OK" to true

Example:
set the default of button otherButton to false

Value (bool):The <default> of a <button(keyword)> is true or false.
By default, the <default> <property> of newly created <button(object)|buttons> is set to false.

Description:
Use the <default> <property> when designing <card(object)|cards> to be used as <dialog box|dialog boxes>. The familiar <appearance> of the default button is a cue to users about what to expect when they use the shortcut of pressing Return or Enter.

When the user presses Enter or Return and there is no active control, LiveCode sends a mouseUp <message> to the <button(keyword)> whose <default> <property> is true. (Also <handle> the <returnInField> and <enterInField> messages to ensure that the default <button(keyword)> is activated even if there is a text <insertion point> or a <control> is <focus|focused>.)

If more than one button's <default> is true, the <message> is sent to the <button(keyword)> whose <default> <property> was set to true most recently.

Changing a button's <default> <property> increases its size, so it also changes its <rectangle> (and related <properties>). Changing the <default> <property> does not change the <button(object)|button's> <location>.

>*Cross-platform note:*  On <OS X|OS X systems>, the default button throbs rhythmically instead of having a border. Because the throbbing <button(keyword)> is drawn by the operating system, its apppearance may not be correct if the <button(keyword)> is placed on top of another <control>. To avoid minor cosmetic problems, place default <button(object)|buttons> directly on the <card(keyword)> rather than on top of other <object|objects>.

References: default (keyword), card (keyword), button (keyword), dialogData (property), properties (property), defaultButton (property), acceleratorKey (property), location (property), enterInField (message), returnInField (message), card (object), object (object), button (object), property (glossary), rectangle (glossary), handle (glossary), OS X (glossary), focus (glossary), insertion point (glossary), message (glossary), appearance (glossary), control (glossary), dialog box (glossary)

Tags: ui
