Ticker

Ticker


Provides a recurring timer event.


Remarks

To create new Ticker using the constructor, call the NewTicker method.

 Private WithEvents mTicker As Ticker

 Private Sub Class_Initialize()
     Set mTicker = NewTicker(2000)
     mTicker.StartTicker
 End Sub

 Private Sub mTicker_Elapsed()
     ' occurs every 2000 milliseconds (2 seconds.)
 End Sub
 
The Ticker can also use a callback function when the time has elapsed instead of only raising an event. The event is still raised, however, a callback function is called as well.
 Private mTicker As Ticker  ' declared without using WithEvents

 Private Sub Main()
     Set mTicker = NewTicker(2000,,, AddressOf TimerCallback)
     mTicker.StartTicker

     ' Application Code
 End Sub

 Private Sub TickerCallback(ByRef Ticker As Ticker, ByRef Data As Variant)
     ' occurs every 2000 milliseconds (2 seconds.)
 End Sub
 

See Also

Project VBCorLib Overview | Constructors

Implements:

IObject 

Public:

Properties:

NameDescription
 AutoReset (get)Returns if the Ticker event will be recurring. 
 AutoReset (let)Sets if the Ticker event will be recurring or not. 
 Callback (get)Returns the callback address of the function used by the Ticker object. 
 Callback (let)Sets the callback address of the function to be used by the Ticker object. 
 Data (get)Returns custom data associated with this Ticker instance. 
 Data (let)Sets custom data associated with this Ticker instance. 
 Data (set)Sets custom data associated with this Ticker instance. 
 Enabled (get)Returns if the Ticker is currently running. 
 Enabled (let)Sets the Ticker to be stopped or running. 
 Interval (get)Returns the duration between Ticker events in milliseconds. 
 Interval (let)Sets the duration between Ticker events in milliseconds. 

Methods:

NameDescription
 EqualsReturns a boolean indicating if the value and this object instance are the same instance. 
 GetHashCodeReturns a pseudo-unique number identifying this instance. 
 StartTickerStarts the Ticker. 
 StopTickerStops the Ticker if it is running. 
 ToStringReturns a string representation of this object instance. 

Events:

NameDescription
 ElapsedThis event is raised when the Ticker interval has been reached.