NoNickName Member Licensed User Jun 9, 2020 #1 I don't know whether this is by design or by chance. I want a timer to fire an event after 1 hour it has been enabled. Unfortunately, as soon as I enable the timer, the event is fired, and again once after the tick elapsed. Is it by design, and if so, how to prevent this to happen?
I don't know whether this is by design or by chance. I want a timer to fire an event after 1 hour it has been enabled. Unfortunately, as soon as I enable the timer, the event is fired, and again once after the tick elapsed. Is it by design, and if so, how to prevent this to happen?
janderkan Well-Known Member Licensed User Longtime User Jun 9, 2020 #2 B4X: Copy Sub Process_Globals Public tim As Timer Private JustStarting As Boolean = False End Sub Private Sub AppStart tim.Initialize("tim_Tick",1000) tim.Enabled=True End Sub Sub tim_Tick If JustStarting Then JustStarting=False Return End If End Sub Upvote 0
B4X: Copy Sub Process_Globals Public tim As Timer Private JustStarting As Boolean = False End Sub Private Sub AppStart tim.Initialize("tim_Tick",1000) tim.Enabled=True End Sub Sub tim_Tick If JustStarting Then JustStarting=False Return End If End Sub