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:
Public:
Properties:
| Name | Description |
|---|
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:
| Name | Description |
|---|
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:
| Name | Description |
|---|
Elapsed | This event is raised when the Ticker interval has been reached. |