I have code like the following. The Wait For part works fine, and does indeed resume when the button is clicked. But the code in Button_Click never runs (ClickedButton, which a global variable, thus remains empty).
Does Wait For somehow consume the button click event? And how can I fix this?
(This is to help a high school student with a coding exercise so I don't need a best practice solution, I just want a solution that is simple and works!)
B4X:
Sub MainModule
Do While True
Wait For Button_Click
Log("You clicked " & ClickedButton)
Loop
End Sub
Sub Button_Click
Dim btn As Button = Sender
ClickedButton = btn.Text
End Sub
Does Wait For somehow consume the button click event? And how can I fix this?
(This is to help a high school student with a coding exercise so I don't need a best practice solution, I just want a solution that is simple and works!)