Hi Bill,

If you like your own approach, just do what you think is best. I discourage such brute force approaches however, because if something goes wrong, the only way for the user to get out of the trap is to restart the software. My example can be adjusted fairly easily to provide a way out:

local lBusy,lSecs
on mouseUp
   if lBusy is true and the optionKey is up then
      beep
      exit mouseUp
   else if lBusy is not true then
      put true into lBusy
      put the seconds into lSecs
      repeat forever with messages
         // some long task here
         if the seconds - lSecs > 5 then exit repeat
         wait 0 millisecs with messages
         if the optionKey is down then exit mouseUp
      end repeat
      put false into lBusy
   else if the optionKey is down then
     put false into lBusy
     // enable disabled controls if any
   end if
end mouseUp

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 7/3/2014 21:26, William Prothero wrote:
Folks:
Actually, I like the method of putting  a transparent rectangle over the stack 
window and trapping all mouse events. That makes the number of places where I 
have to modify my code much smaller. I have multiple buttons on the screen and 
they each call a number of handlers. I just thought there might be a command to 
disable mouse messages.
Best,
Bill

On Jul 3, 2014, at 10:45 AM, Mark Schonewille 
<[email protected]> wrote:

Hi Bill,

One way to do this:

local lBusy,lSecs
on mouseUp
   if lBusy is true then
      beep
      exit mouseUp
   else if lBusy is not true then
      put true into lBusy
      put the seconds into lSecs
      repeat forever with messages
         // some long task here
         if the seconds - lSecs > 5 then exit repeat
         wait 0 millisecs with messages
      end repeat
      put false into lBusy
   end if
end mouseUp

This script doesn't allow running the script again, as long as it hasn't 
finished. If you have multiple controls that should not be used while the 
script runs, you can disable the other controls or use a global variable and 
check the global variable in the other scripts.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 7/3/2014 19:32, William Prothero wrote:
Folks:

Is it possible to inhibit mouse events? Some of the operations that are 
initiated by a mouse click require a bit of time and I don’t want the user to 
be able to click around until each operation is finished. One approach would be 
to put a transparent rectangle over the stack and not pass events, but I wonder 
if there is a more direct way.

Thanks,
Bill

William A. Prothero, Ph.D.
University of California, Santa Barbara Dept. of Earth Sciences (Emeritus)
Santa Barbara, CA. 93105
http://es.earthednet.org/



_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to