Ticker

Ticker


Provides a recurring timer event.


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.  
 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
 Equals Returns a boolean indicating if the value and this object instance are the same instance.  
 GetHashCode Returns a pseudo-unique number identifying this instance.  
 StartTicker Starts the Ticker.  
 StopTicker Stops the Ticker if it is running.  
 ToString Returns a string representation of this object instance.  

Events:

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

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 CorLib Overview

Class Ticker Overview

Constructors