Class: cTimer

Properties  Events  Methods    Index of Classes

cTimer objects can be used to trigger an event after a certain amount of time has passed.



Library: Windows Application Class Library

Package: cTimer.pkg


cTimer objects can be used to trigger an event after a certain amount of time has passed.

Use cWebTimer for web applications.

cIdleHandler is used to create objects that generate events on a periodic basis.

You can specify the time interval for timed events by setting the piTimeOut property of the object. When you wish to set a new timeout interval, you can do so even when the timer is active. It will adjust the timeout immediately.

At the prescribed interval, the timer will send an OnTimer event. You can trap this event to do whatever you want.

A timer is activated by setting pbEnabled to True.

The minimum timer delay is 10 ms, but in practical terms, it's 15.6 ms or more. Timer events depend on Windows for the delivery of the event. Since timer events get a low priority in Windows, Windows may stop the timer process when other programs are very busy. When this happens, the timer will stop until the process is resumed. There is no way, other than calculating it yourself, to determine how much time passed or how many timer events should have happened between the last timer event before the process was stopped and the first event after the process is resumed.


Use cTimer.pkg

Class cAutoCompleteTimer is a cTimer

    Procedure Construct_Object
        Forward Send Construct_Object
        Property Handle phoTimerOwner 0
        Set piTimeout to 50
    Procedure OnTimer 
        Handle hoOwner

        Get phoTimerOwner to hoOwner
        // do this in case program close destroys owner before timer
        Get Object_Id of hoOwner to hoOwner
        If hoOwner Begin
            // do something
        Else Begin
            // something is wrong, shut off timer
            Set pbEnabled to False