[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'StdCtrls' (#lcl)

# TCustomButton.Cancel

True if the button is the modal Cancel button.

## Declaration

Source position: stdctrls.pp line 1259

`public property TCustomButton.Cancel : Boolean read FCancel write SetCancel default False;`

## Description

Cancel is a Boolean property which indicates if the button is the modal Cancel button on a form. The default value for the property is False.

Setting a new value for the property causes the CancelControl in the parent form to be updated. When set to True, the CancelControl property in the parent form is set the current class instance. When set to the False, the form property is set to Nil.

No actions are performed in the method when NewCancel has the same value as the Cancel property, or the parent form has not been assigned.

The value in Cancel is automatically updated in methods like UpdateRolesForForm and UpdateDefaultCancel. The property value is used in ExecuteCancelAction to determine if the Click method can be called for the control.

Pressing Escape (VK_ESCAPE) in a modal form is equivalent to clicking on the Cancel button.