Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Check multi-keys press
-
There are four methods you can implement:
https://developer.apple.com/documentation/uikit/uiresponder/1621134-pressesbegan?language=objc
You also have pressesEnded_withEvent_, and pressesChanged_withEvent_. Technically, pressesCancelled_withEvent_, but that's rare.
You can inspect the modifiers:
UIKeyModifierAlphaShift 1<<16
A modifier flag that indicates the user pressed the Caps Lock key.
UIKeyModifierShift 1<<17
A modifier flag that indicates the user pressed the Shift key.
UIKeyModifierControl 1<<18
A modifier flag that indicates the user pressed the Control key.
UIKeyModifierAlternate 1<<19
A modifier flag that indicates the user pressed the Option key.
UIKeyModifierCommand 1<<20
A modifier flag that indicates the user pressed the Command key.
UIKeyModifierNumericPad 1<<21
A modifier flag that indicates the user pressed a key located on the numeric keypadAlso, to check for special characters, you would look at charactersIgnoringModifiers, and check for special strings from https://developer.apple.com/documentation/uikit/uikeycommand/input_strings_for_special_keys?language=objc
for example 'UIKeyInputRightArrow'
(Convert to str before comparing).
Technically, when looking at apple docs, in this case then consts are defined as NSString *, so the way you get the value is
ObjCInstance(c_void_p.in_dll(c, 'UIKeyInputRightArrow'))
But in this case, the NSString is simply equal to the constant name.
-
@JonB so….. what should i change?