# The MIT License (MIT)
#
# Copyright (C) 2026 Scott Duensing
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

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