Xojo R2.1 - Example to check a database or make a other process (xx) minutes.
Objetive: check new info in my database any 2 minutes
Timer Object
a) Put Timer object in your windows
b) Set Timer Properties Mode: Multiple Period: 1000
Window Definitions and object
a) put textfield1 objet in you windows panel
b) Rename textfield1 to TextFieldTime
c) Open a (action) in timer and write this:
dim mins, secs as integer
self.countdowntime = self.countdowntime - 1
mins = self.countdowntime \ 60
secs = self.countdowntime mod 60
TextFieldTime.text = str(mins, “0”) + “:” + str(secs, “00”)
’ ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
’ Control to reinit Timer o Schedule Action
’ ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
if TextFieldTime.text = “0:00” then
' Put Timer off
countdowntime = 120 // Redefine Time
Timer1.Enabled = false // Deactive timer
’ ************
Call MyRoutineToCheckDatabase() //Check database new info
’ ***********
’ Put timer on
Timer1.Enabled = true
Timer1.Reset
end if