calling handlers with keys

Klaus Major kmajor at metascape.org
Fri Mar 15 08:28:01 EST 2002


Tach Uwe ;-)
(Hi Uwe,)

> Hi all!
>
> Before bothering you with silly questions I´d like to introduce myself 
> as a MC newby with some experience with HyperCard in the context of 
> Experimental Psychology. Please excuse me if I´m using weird terms 
> sometimes, but apart from having no formal training in programming I´m 
> also german ;-)

The latter is not a disadvantage per se ;-)
>
> I need a way to call handlers within a repeat loop at different 
> keyBoard actions, like
>
> repeat
>    "keyX"-->handler1
>    "keyY"-->handler2
>    "keyZ"-->handler3
> end repeat
>
> I understand I could use the commandKey, enterKey etc. messages, but 
> that´s not very handy. The next thing in my mind was using keysDown(), 
> but the problem here is, that the keys pressed "survive" in keysDown() 
> during subsequent repeats and I can´t disriminate if the key was 
> pressed again or if it´s still the key from the foregoing repeat. At 
> the moment I solve this by sending a type command, which slows down the 
> execution of the rest of the repeat loop.
>
> I´m sure there is a more elegant way to solve the problem?
>
> Best regards,
> Uwe

Mabe this could help ?

on keydown der_kieh
   switch der_kieh
     case "X"
         handler1
         break
     case "Y"
         handler2
         break
     case "Z"
         handler3
         break
    end switch
end keydown

So there is not even a repeat-loop necessary...

Viel Spass...
Have fun...


Gruss
Regards


Klaus Major
kmajor at metascape.org




More information about the metacard mailing list