Repeat until (mouseDoulbeUp?)
Jan Schenkel
janschenkel at yahoo.com
Wed Nov 23 01:10:11 EST 2011
Hi James,
The trick is to use 'wait with messages' in your 'repeat' loop. This allows the processing of events, including 'mouseDoubleUp' - which in turn allows you to set some sort of flag, which the loop can check afterwards to know if it needs to exit. Bear in mind that the 'wait with messages' does nothing to limit the user interface, and you will now be able to click on other buttons, so use with care and disable controls that might interfere.
Here's a recipe to illustrate:
- create a new stack, and drop a button and a scrolling field onto it
- set the button script to:
##
local sStatus
on mouseUp
if sStatus is not "running" then
put "running" into sStatus
DisableOtherControls
repeat with i = 1 to 500
put return & i after field 1
wait500millisecondswithmessages
if sStatus is not "running" then exit repeat
end repeat
EnableOtherControls
else
pass mouseUp
end if
end mouseUp
on mouseDoubleUp
if sStatus is "running" then
put "stopped" into sStatus
end if
end mouseDoubleUp
command DisableOtherControls
disablefield1
end DisableOtherControls
command EnableOtherControls
enablefield1
end EnableOtherControls
##
If you're interested, you can always read the blogpost that I wrote about this last year:
<http://quartam.blogspot.com/2010/03/but-waiting-makes-me-curious.html>
HTH,
Jan Schenkel.
=====
Quartam Reports & PDF Library for LiveCode
www.quartam.com
=====
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
________________________________
From: James Hurley <jhurley0305 at sbcglobal.net>
To: use-livecode at lists.runrev.com
Sent: Wednesday, November 23, 2011 12:56 AM
Subject: Repeat until (mouseDoulbeUp?)
is it possible to terminate (exit) a repeat loop with a mouseDoubleUp?
Thanks,
Jim Hurley
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list