Applies to

CommandButton, PictureButton, OLECustomControl controls


Cancel defines whether the Esc key activates the button or control. If the Cancel property is enabled, the Esc key triggers the control's Clicked event. If Cancel is not enabled, the control does not respond to the Esc key.

If you enable Cancel for more than one control, the last one set responds to the Esc key.


In a painter

To enable the Cancel property:

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

In scripts

The Cancel property takes a boolean value. The following line allows the CommandButton to respond to the Esc key:

cb_1.Cancel = TRUE