On KeyDown Bug

Stephen Barncard stephenREVOLUTION at barncard.com
Sun Mar 26 23:41:55 EST 2006


WAIT. don't send a bug report yet...how is it working at all?

don't forget the BREAK statement in your SWITCH structure...

on keyDown theKey
   local theModifier
   put "" into theModifier
   switch
   case the optionKey is down
     put "Opt " after theModifier
     break -- <----------
   case the CommandKey is down
     put "Cmd " after theModifier
     break -- <----------
   case the shiftKey is down
     put "Shft " after theModifier
     break -- <----------
   case the controlKey is down
     put "Ctrl " after theModifier
     break -- <----------
   end switch
   put char 1 to -1 of theModifier into theModifier
   replace " " with "-" in theModifier
   put theModifier && theKey
   pass keyDown
end keyDown



>Hi Everyone. This may be a bug, I do not know. Observe the following 
>snippet in the script of the stack:
>
>on keyDown theKey
>   local theModifier
>   put "" into theModifier
>   switch
>   case the optionKey is down
>     put "Opt " after theModifier
>   case the CommandKey is down
>     put "Cmd " after theModifier
>   case the shiftKey is down
>     put "Shft " after theModifier
>   case the controlKey is down
>     put "Ctrl " after theModifier
>   end switch
>   put char 1 to -1 of theModifier into theModifier
>   replace " " with "-" in theModifier
>   put theModifier && theKey
>   pass keyDown
>end keyDown
>
>This SHOULD put the modifier keys and the key typed in the result of 
>the message box. It works when I just type letters. BUT when I use a 
>modifier that is NOT the shift key, I get NOTHING. IF I use the 
>Shift key I get "Shft-Crtl " followed by the letter typed, even 
>though the Control key is NOT down!
>
>Well this cannot be right! What is really needed is a new argument 
>in the keyDown and keyUp handlers for the modifier keys. I should be 
>able to write the handler this way:
>
>on keyDown theKey, theModifiers
>if "Shift" is in theModifiers then
>   -- some stuff here
>end if
>pass keyDown
>end keyDown
>
>I guess this is a bug report AND a feature request.
>
>Bob Sneidar
>IT Manager
>Logos Management
>Calvary Chapel CM

-- 
stephen barncard
s a n  f r a n c i s c o
- - -  - - - - - - - - -



More information about the use-livecode mailing list