SetCancelButton()

Summary

Sets the Cancel button for the dialog box.

Changes

Added to Version 2017.

Syntax

SetCancelButton(string buttonName)

Argument Contents
buttonName The name of the button

Notes

  • SetCancelButton() will override any previously set Cancel button for this dialog box.

  • When you press Escape, or click the X close symbol in the dialog box, the do-enditem for this button will be executed.

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

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

Example

Dbox "CancelTest"
// 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 Cancel button
NotFound There is no button with this name in the dialog box

See Also

Function Summary
SetDefaultButton() Sets the Default button for the dialog box