Sub Globals
Dim IgnoreToggleEvent As Boolean
Dim HasUserChangedValue As Boolean
Dim tb As ToggleButton
End Sub
Sub Activity_Create(FirstTime As Boolean)
tb.Initialize("tb")
Activity.AddView(tb, 0, 0, 100dip, 100dip)
tb.Checked = True
End Sub
Sub tb_CheckedChange(Checked As Boolean)
If IgnoreToggleEvent Then Return
HasUserChangedValue = True
Log("User changed")
End Sub
Sub Activity_Click
IgnoreToggleEvent = True
tb.Checked = Not(tb.Checked)
IgnoreToggleEvent = False
End Sub