button to exit loop...
Posted: Fri Apr 11, 2014 5:16 am
I have a small program that displays a new random number every 1200 milliseconds after clicking a button. It uses a loop that repeats while the variable gstop = 0. I have a "stop" button that should set the value of gstop to 1, to exit the loop and stop the program. It looks like this:
However once the repeat loop is running clicking my "stop" button has no effect. All I can think of is the wait command might be blocking input for most of the time. Is there an easier way to have a button that will simply exit this loop? Can I use the same button to start and stop the loop?
Thanks for any advice or suggestions,
TJ.
Code: Select all
global gstop
on mouseUp
put 0 into gstop
repeat while gstop = 0
put random(99) into field "Label Field"
wait 1200 milliseconds
end repeat
end mouseUp
Thanks for any advice or suggestions,
TJ.