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.

Diese Klasse ist erstellbar.

Eigenschaften
Delay   Returns or sets the number of milliseconds between each event raised by the timer.
Enabled   Returns or sets whether the timer is enabled.
Ignore   Return or set if the timer is ignored.

Methoden
Restart   Just stop then start the timer again.
Start   Starts the timer.
Stop   Stops the timer.
Trigger   Triggers the timer once, at the next event loop.

Ereignisse
Timer   This event is raised each time the timer is triggered.

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
...