'wait 0 ticks with messages' was the thing - thanks!

So a general (stack-wide) approach might be to use a custom prop in the stack:

in a control, card or stack:
on handlerWithRepeatIMightWantToInterrupt
  set the canInterrupt of this stack to true
  repeat forever
    wait 0 ticks with messages
    doRepeatStuff
  end repeat
  set the canInterrupt of this stack to false
  otherStuff
end handlerWithRepeatIMightWantToInterrupt

then in the stack script

on escapeKey
  if the canInterrupt of me then
    set the canInterrupt of me to false
    exit to top
  end if
end escapeKey


Mark

On 19 Mar 2006, at 22:24, Geoff Canyon wrote:


On Mar 19, 2006, at 12:04 PM, Mark Smith wrote:

Andre, the trouble is that in the case of interrupting a repeat loop, you can't test for whether the escape key is down like you can with control/option/command.

So use control/option/command, of course :)
But the escape key would be more natural...

This works:

local sGetOut

on mouseUp
  put empty
  put false into sGetOut
  repeat 20000
    wait 0 ticks with messages
    if sGetOut then exit to top
  end repeat
  put "completed"
end mouseUp

on escapeKey
  put true into sGetOut
end escapeKey

Note that the escapeKey message is delivered to the focused control, so you can't put it in a button and expect it to work reliably. Put the above in the card script, then click anywhere in the card. Some time later "completed" will show in the message box. Then click the card again and then press the escape key. You won't get the "completed" text.

gc
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to