Hello. Consider this code please:
What I expect, naturally, is that as long as the mouse is kept held on the label, I'd get the "button still down" message every half second, but once the mouse button is released, it should stop. But, surprisingly, the loop continues. In other words, although the boolean variable "Working" is set to "false", the first event still treats it as "true", ignoring the change in its value.
* Log output: *
Button has been released
Button's still down
Button's still down
Button's still down
Button's still down
......
What's crazy is that the mechanism works fine when I test it in an empty project.
Any ideas what's happening here?
Thanks.
B4X:
Private Sub MyLabel_MouseClicked (EventData As MouseEvent)
Working = True
Do While Working
Log("Button's still down")
Sleep(500)
Loop
End Sub
Private Sub MyLabel_MouseReleased (EventData As MouseEvent)
Working = False
Log("Button has been released")
End Sub
* Log output: *
Button has been released
Button's still down
Button's still down
Button's still down
Button's still down
......
What's crazy is that the mechanism works fine when I test it in an empty project.
Any ideas what's happening here?
Thanks.