Handles multiple registrations for keycode and modifier combinations. This object should be used as the keydown or keyup action for a view in place of a function.
KeyCodes are hardware dependant, and change from machine to machine. Its a simple way to hook up keys to respond, but it won't transfer to other people's computers.
see also [UnicodeResponder] which matches based on the unicode, though the physical location of the key may still vary according zee nationality ov der keyboard. Command modifiers cannot be registered using the register method; use registerKeycode instead (see example below).
for shift, caps,opt,cntl true indicates a required modifier false indicates an excluded modifier nil expresses that you really don't care one way or the other
Arguments:
keycode | |
shift | |
caps | |
opt | |
cntl | |
function | |
Arguments:
view | |
keycode | |
modifier | |
unicode | |
Arguments:
keycode | |
requireMask | |
denyMask | |
function | |
description | |
note the association ( key -> value )
Arguments:
Arguments:
keycode | |
shift | |
caps | |
opt | |
cntl | |
function | |
description | |
Arguments:
view | |
char | |
modifier | |
unicode | |
keycode | |
Arguments:
keycode | |
requireMask | |
denyMask | |
function | |
description | |
Use this to post the keycodes
Any player's gui can have its keyDownAction set
focus on the slider. notice that every key stroke is passed, the slider does not swallow them.
or you can use KeyCodeResponder
This means that when ever the player is focused (any of its controls is in focus), these keys will be active providing that the view that is actually in focus doesn't handle the key event (it should have a nil keyDownAction function or pass nil).
You can concatenate KeyCodeResponders using ++
global keydowns not yet tested....
This is very useful when using CAPS-LOCK to switch interface modes etc.
Only one function per deny/require mask combination is possible per keycode:
The simpler, older method is :
whereby that modifier and only that modifier will fire the funtion. see View for modifier values or use this :
// using characters
Gotcha: it is easy to forget that you registered a function with KeyCodeResponder that holds a reference to a large object. Garbage Collection will not remove the object until you have released your reference.
solution: