This can be used to replace a function in a view's keydownAction. It matches modifier/unicode combinations and then evaluates the matched handler.
This is one of the simplest ways to accurately match the exact modifier combination you want.
If you merely check the modifier like so: (modifer & optionModifier ) == optionModifier or modifier.isAlt
then you will detect the presence of the options key, but not if ONLY the option key is present ( ie. it will match for shift-option as well )
see KeyCodeResponder
true: must be pressed false: must not be pressed nil: can be either pressed or not pressed
Use this to post the codes:
Arguments:
unicode | |
shift | |
caps | |
opt | |
cntl | |
function | |
Arguments:
unicode | |
requireMask | |
denyMask | |
function | |
description | |
Arguments:
view | |
char | |
modifiers | |
unicode | |
keycode | |
Arguments:
view | |
char | |
modifier | |
unicode | |
keycode | |
Arguments:
unicode | |
shift | |
caps | |
opt | |
cntl | |
function | |
description | |
Arguments:
unicode | |
requireMask | |
denyMask | |
function | |
description | |
The view in this example is merely to have something to focus on, it does nothing else.
Note that to match shift-a you have to specify "A", not "a"
You can also specify with ascii characters