calling handlers with keys

Geoff Canyon gcanyon at inspiredlogic.com
Sat Mar 16 23:01:01 EST 2002


At 2:50 PM +0100 3/15/02, Uwe Friese wrote:
>The problem with the keyDown messages is that I need the rest of the script inside the repeat loop to be executed constantly (to present a stream of objects on the screen). Like this:
>
>repeat
>    presentSomeObjects -- this has to be performed constantly
>                                   -- sometimes there is a key pressed; in this case I need:
>  "keyX"-->handler1
>  "keyY"-->handler2
>  "keyZ"-->handler3
>end repeat
>
>I have the strong feeling, that I´m missing something here. Of course "on keyDown" won´t work, but how else can I achieve this behavior?

You can use keyDown as long as you get rid of the repeat loop, and you can do that using send...in. Basically your code will look something like:

on presentSomeObjects
 -- do something here
 send presentSomeObjects to me in 1 second -- or whatever time
 put the result into gPresentMessage -- allows you to cancel if needed
end presentSomeObjects

on keyDown pWhichKey
 -- do something based on the key
end keyDown

regards,

Geoff



More information about the metacard mailing list