Testing clock app

tinmanjo

Member
Licensed User
Forgive me most sincerly for being a newbie, but im stuck on the most basic code problem.

i set a form and created a timer, button, and textbox. basically the program is ultra simple it mearly displays time when you click a button and the button acts as a toggle to swich time on and off.

the problem im having is that i need to check the logic of the timer.enabled in an if statement but this doesnt work for some reason.

if timer1.enabled=false then
timer1.enabled=true
button1.text="Stop"
end if

:confused:

how do you reference values of the properties of an object.

is this right.

timer1.enabled=value (true/False)
 

taximania

Well-Known Member
Licensed User
Longtime User
The below code toggles the timer on/off

B4X:
Sub Globals
   'Declare the global variables here.

End Sub

Sub App_Start
   Form1.Show
   timer1.Enabled=True
   button1.Text="Stop"
   textbox1.Text=timer1.Enabled
End Sub




Sub Button1_Click
If timer1.enabled=False Then
timer1.enabled=True
button1.text="Stop"
textbox1.Text=timer1.Enabled
Else
timer1.enabled=False
button1.text="Go"
textbox1.Text=timer1.Enabled
End If
End Sub
 
Top