TTimer( unit KOL.pas ) TObj _TObj
TTimer = object( TObj )
Easy timer encapsulation object. It uses separate topmost window, common for all timers in the application, to handle WM_TIMER message. This allows using timers in non-windowed application (but anyway it should contain message handling loop for a thread).
Note: in UNIX, there are no special windows created, certainly.
TMMTimer( unit KOL.pas ) TTimer TObj _TObj
TMMTimer = object( TTimer )
Multimedia timer encapsulation object. Does not require Applet or special window to handle it. System creates a thread for each high resolution timer, so using many such objects can degrade total PC performance.
type TTimer = object( TObj )
Easy timer encapsulation object. It uses separate topmost window, common for all timers in the application, to handle WM_TIMER message. This allows using timers in non-windowed application (but anyway it should contain message handling loop for a thread).
Note: in UNIX, there are no special windows created, certainly.
type TMMTimer = object( TTimer )
Multimedia timer encapsulation object. Does not require Applet or special window to handle it. System creates a thread for each high resolution timer, so using many such objects can degrade total PC performance.
Constructors:
function NewTimer( Interval: Integer ): PTimer;
Constructs initially disabled timer with interval 1000 (1 second).
function NewMMTimer( Interval: Integer ): PMMTimer;
Creates multimedia timer object. Initially, it has Resolution = 0, Periodic = TRUE and Enabled = FALSE. Do not forget also to assign your event handler to OnTimer to do something on timer shot.
TTimer properties
property Handle: Integer;
Windows timer object handle.
property Enabled: Boolean;
True, is timer is on. Initially, always False.
property Interval: Integer;
Interval in milliseconds (1000 is default and means 1 second). Note: in UNIX, if an Interval can be set to a value large then 30 minutes, add a conditional definition SUPPORT_LONG_TIMER to the project options.
TMMTimer properties
property Resolution: Integer;
Minimum timer resolution. The less the more accuracy (0 is exactly Interval milliseconds between timer shots). It is recommended to set this property greater to prevent entire system from reducing overhead. If you change this value, reset and then set Enabled again to apply changes.
property Periodic: Boolean;
TRUE, if timer is periodic (default). Otherwise, timer is one-shot (set it Enabled every time in such case for each shot). If you change this property, reset and set Enabled property again to get effect.
TTimer methods
destructor Destroy; virtual;
Destructor.
TTimer events
property OnTimer: TOnEvent;
Event, which is called when time interval is over.