Relatively Simple Question: MouseDown event handling
Posted on 2002-03-28
I am handling a mousedown event on a button. I want to execute a line of code, say, increase some integer's value by one, as long as the mouse is down on the button.
What i see is, if don't use a loop, the code is executed only once.
The other method i tried was:
1. declared a global variable,
2. execute that one statement in the loop in mousedown event's method as long as the global variable's value doesn't change..
3. change the value of global variable in mouseup ( or mousereleased ) event.
But the loop in mousedown event never breaks even after the mouse is released.
Any suggestions? I just want to repeatedly do something as long as the mouse is pressed on the button.