comp • gb • timer

Timer (gb)

This class implements a timer object.

A timer object raises events, each time it is triggered. The amount of time between each event is specified by the Delay property.

This class is
Creates a new timer.
creatable
.

Properties

Methods Events
Returns or sets the number of milliseconds between each event raised by the timer.
Delay  
Returns or sets whether the timer is enabled.
Enabled  
Just stop then start the timer again.
Restart  
Starts the timer.
Start  
Stops the timer.
Stop  
Triggers the timer once, at the next event loop.
Trigger  
This event is raised each time the timer is triggered.
Timer  

Example

This example demonstrates the usage of the Timer in a Console program.

' Gambas module file

Public hConsoleTimer As Timer

Public Sub Main()

  hConsoleTimer = New Timer As "MyTimer"
  hConsoleTimer.Delay = 1000
  hConsoleTimer.Enabled = True

End

Public Sub MyTimer_Timer()

  Print CInt(Timer);; "Hello Gambas"

End
0 Hello Gambas
1 Hello Gambas
2 Hello Gambas
...