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

# TCustomUpDown.CanChange

Indicates whether a change using the control can be applied.

## Declaration

Source position: comctrls.pp line 1987

`protected function TCustomUpDown.CanChange: Boolean; virtual;`

## Function result

Returns True if the assigned event handlers allow the Position property to be changed.

## Description

CanChange is a Boolean function used to determine if a change caused by interaction with the control can be applied. CanChange is called from the Click method, and occurs prior to applying a new value to the Position property and signalling the OnClick event handler. If CanChange returns False, the new value is not applied to the Position property and the event handler is not signalled.

CanChange uses the OnChanging and OnChangingEx event handlers to determine the return value for the method. The default return value is True and is used if both event handlers are unassigned in the control.

Remark: | Both events are signalled (when assigned) and both can update the return value in their handler routines.

Use OnChanging to handle application logic not tied to the value in Position or the direction for the value change. Use OnChangingEx to handle logic where the new value and change direction are examined.

## See also

TCustomUpDown.Click |  | Handles a mouse click on a speed button in the control.
TCustomUpDown.OnChanging |  | Event handler signalled prior to changing the value in the Position property.
TCustomUpDown.OnChangingEx |  | Event handler signalled to determine if the control can change the value in the Position property.
TCustomUpDown.Position |  | The current position (or value) for the control as a SmallInt type.