[Overview][Classes][Index] | Reference for unit 'CustomTimer' (#lcl)

# TCustomTimer

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Defines the base class for TTimer.

## Declaration

Source position: customtimer.pas line 31

`type TCustomTimer = class(TComponent)`
`protected`
`procedure SetEnabled(); virtual;` |  | Sets the value for the Enabled property.
`procedure SetInterval(); virtual;` |  | Sets the value for the Interval property.
`procedure SetOnTimer(); virtual;` |  | Sets the event handler for the OnTimer property.
`procedure DoOnTimer; virtual;` |  | DoOnTimer signals the OnTimer event handler.
`procedure UpdateTimer; virtual;` |  | Updates the Timer to reflect the current properties.
`procedure KillTimer; virtual;` |  | Stops execution of the timer class instance.
`procedure Loaded; override;` |  | Performs actions needed when LCL component streaming has been completed.
`public`
`constructor Create(); override;` |  | Create - constructor for TCustomTimer: calls inherited Create, sets up handle and initializes timer interval.
`destructor Destroy; override;` |  | Destructor for the timer class instance.
`property Enabled: Boolean; [rw]` |  | Indicates if the timer is ready to start.
`property Interval: Cardinal; [rw]` |  | The Interval (in milliseconds) for timer notifications.
`property OnTimer: TNotifyEvent; [rw]` |  | Event handler signalled when the Interval for the timer has elapsed.
`property OnStartTimer: TNotifyEvent; [rw]` |  | Event handler signalled when the timer is started.
`property OnStopTimer: TNotifyEvent; [rw]` |  | OnStopTimer - event handler for stopping the timer.
`end;`

## Inheritance

`TCustomTimer` |  | Defines the base class for TTimer.
`TComponent`
?
`TObject`

## Description

TCustomTimer is a TComponent descendant which specifies the base class for TTimer. TCustomTimer specifies the properties, methods, and events handlers used for timer classes in the LCL.

Use the Enabled property to indicate if the timer can be executed.

Use the Interval property to control the frequency of notification events from the executing timer class instance.

Use the OnTimer, OnStartTimer, and OnStopTimer event handlers to perform actions needed for the corresponding execution state in the timer class instance.

Do not create instances of TCustomTimer; use the TTimer descendant class in the ExtCtrls.pp unit.

## See also

TCustomTimer.Enabled |  | Indicates if the timer is ready to start.
TCustomTimer.Interval |  | The Interval (in milliseconds) for timer notifications.
TCustomTimer.OnTimer |  | Event handler signalled when the Interval for the timer has elapsed.
TCustomTimer.OnStartTimer |  | Event handler signalled when the timer is started.
TCustomTimer.OnStopTimer |  | OnStopTimer - event handler for stopping the timer.
TTimer |  | TTimer is an elapsed timer useful in many applications.