Trapping the escape key inside a loop

David Coker davidocoker at gmail.com
Tue Apr 6 20:14:49 EDT 2010


Howdy folks,
Scratching my head in wonderment again, trying to figure out why I
can't trap the escape key.
Here is a sample script that I've been playing with outside of my real
app that is pretty close to the real thing:

global gStop

on mouseUp
put 0 into gStop
do ThisHandler
do ThatHandler
  repeat with i = 1 to 10000
    if gStop = 1 then exit repeat
      do some useful work here
  exit repeat
do CleanUpRoutine
end mouseUp



I've tried the following handler at the button level, the card level
and the stack level, yet can't for the life of me, get it to break the
repeat loop using a simple flag method.

on escapeKey
  put 1 into gStop
end escapeKey

I can easily trap the escape key anywhere outside of the loop with no
problems, but I'm obviously missing something while in the loop.
Any help out there?

Best regards,
David C.



More information about the use-livecode mailing list