.topic ctrl.timer
.title Timer
.toc 1 Timer
.index Timer
.index Interval
.index Start
.index Stop

.h1 Timer

VB Equivalent: Timer -- DVX Widget: timer (non-visual)

A non-visual control that fires its event at a regular interval. The Timer widget is invisible at runtime -- it has no on-screen representation.

.h2 Type-Specific Properties

.table
  Property   Type      Description
  --------   -------   -------------------------------------------
  Enabled    Boolean   True to start the timer, False to stop it.
  Interval   Integer   Timer interval in milliseconds (write-only from BASIC).
.endtable

.h2 Type-Specific Methods

.table
  Method   Parameters   Description
  ------   ----------   -------------------------------------------
  Start    (none)       Start the timer.
  Stop     (none)       Stop the timer.
.endtable

.h2 Type-Specific Events

.table
  Event   Parameters   Description
  -----   ----------   -------------------------------------------
  Timer   (none)       Fires each time the interval elapses. This is the default event.
.endtable

.note info
The Timer control fires the Timer event instead of Change. The onChange callback on the underlying widget is remapped automatically.
.endnote

.h2 Example

.code
Begin Timer Timer1
    Interval = 1000
    Enabled  = True
End

Dim counter As Integer

Sub Timer1_Timer ()
    counter = counter + 1
    Label1.Caption = "Ticks: " & Str$(counter)
End Sub
.endcode

.link ctrl.common.props Common Properties, Events, and Methods
