Repeat until (mouseDoulbeUp?)

Jan Schenkel janschenkel at
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
      repeat with i = 1 to 500
         put return & i after field 1
         if sStatus is not "running" then exit repeat
      end repeat
      pass mouseUp
   end if
end mouseUp

on mouseDoubleUp
   if sStatus is "running" then
      put "stopped" into sStatus
   end if
end mouseDoubleUp

command DisableOtherControls
end DisableOtherControls

command EnableOtherControls
end EnableOtherControls

If you're interested, you can always read the blogpost that I wrote about this last year:


Jan Schenkel.
Quartam Reports & PDF Library for LiveCode

"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

 From: James Hurley <jhurley0305 at>
To: use-livecode at 
Sent: Wednesday, November 23, 2011 12:56 AM
Subject: Repeat until (mouseDoulbeUp?)
is it possible to terminate (exit) a repeat loop with a mouseDoubleUp?


Jim Hurley

use-livecode mailing list
use-livecode at
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the Use-livecode mailing list