Sign in Join
FPDoc Onlineexperiment

TCustomUpDown.CanChange function

Member of TCustomUpDownprotectedIn unit ComCtrls

Indicates whether a change using the control can be applied.

Declaration

pascal
function 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.

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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.