SetDefaultButton()

Summary

Sets the Default button for the dialog box.

Changes

Added to Version 2017.

Syntax

SetDefaultButton(string buttonName)

Argument Contents
buttonName The name of the button

Notes

  • SetDefaultButton() will override any previously set default button for this dialog box.

  • When you press Enter in the dialog box, the do-enditem for this button will be executed.

  • SetDefaultButton() can be called in the init item of the dialog box, or at a later time, so you can change the Default button, since it does not have to be specified at compile time.

  • For more information on the Default button, see Push Buttons.

Example

Dbox "DefaultTest"
// button "X" closes dialog
button "X" 1, 1, 10 cancel do return() enditem
// button "Y" is default, shows a message
button "Y" 1, 2.5, 10 default do ShowMessage("Hi") enditem
radio list 1, 4, 30, 5
radio button 2, 5.5 prompt: "Set X as Default, Y as Cancel" do
SetDefaultButton("X")
SetCancelButton("Y")
enditem
radio button 2, 7 prompt: "Set Y as Default, X as Cancel" do
SetDefaultButton("Y")
SetCancelButton("X")
enditem
endDbox

Error Codes

Error Type Meaning
Error There was an error setting the default button
NotFound There is no button with this name in the dialog box

See Also

Function Summary
SetCancelButton() Sets the Cancel button for the dialog box