0
我是法國人,我的英語很抱歉我盡我所能...B4A插入計時器在代碼
我嘗試調用子命名timer1_tick,我希望它停止我的子「b_reponse1_click」。問題是,我的子不要等到定時器結束...
代碼:
Sub Process_Globals
Dim Timer1 As Timer
....
End Sub
Sub Activity_Create(FirstTime As Boolean)
Timer1.Initialize("Timer1", 1000) ' 1000 = 1 second
Timer1.Enabled = True
...
End Sub
Sub b_reponse1_Click
p= p + 1
If b_reponse1.Text = r5 Then
score = score + 1
b_reponse1.Color=Colors.Green
CallSub("",timer1_tick) ' Here i call sub timer1_tick
b_reponse1.Color=Colors.Gray
Else
b_reponse1.Color=Colors.Red
b_reponse1.Color=Colors.Gray
End If
If nbqpassee = 10 Then
Activity.RemoveAllViews
Activity.LoadLayout("lay_main")
Else
CallSub("",loadq)
End If
End Sub
定時器1的倒計時,但我的子b_reponse1_Click繼續執行,而不等待計時器結束
定時器:
代碼:
Sub timer1_tick
t = t + 1
Log(t)
End Sub
我試試這家b UT沒有解決我的問題:
代碼:
Sub timer1_tick
t = t + 1
Log(t)
timer1.Enabled = False
End Sub
你知道我該怎麼做才能阻止我的子b_reponse1_click約1秒?
感謝提前回答!