## How to make a timer

    ' Gambas class file
    PUBLIC SUB _new()

      TextLabel1.Text = "XXXXXX"
      Timer1.Delay = 200
      Timer1.Enabled = TRUE

    END

    PUBLIC SUB Timer1_Timer()

      IF TextLabel1.Text = "XXXXXX" THEN
        TextLabel1.Text = "UUU"
      ELSE
        TextLabel1.Text = "XXXXXX"
      END IF

    END

The Timer Program

This miniprogram shows you the use of the timer. The Timer is a unvisible widget, which makes it possible to program a time course. If the Timer property is enabled, then the method starts again and again with a given delay.

You need 1 timer widget to get the program going. The timer must be enabled, when it shall start. Therefore you should switch the Enabled Property of the timer to the value TRUE.

The Code

    PUBLIC SUB Timer1_Timer()
     PRINT 1
    END

If you want to stop the timer, then add a commandbutton to your form with the following code:

    PUBLIC SUB Button1_Click()
    Timer1.Enabled = FALSE
    END

-- ReinerHoffmann - 31 Jan 2004