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
-
@cvp no it’s my wrong again xD They’re absolutely no difference before, lol
-
@cvp I’ve already changed it, read it again :D The difference is
[0].key().keyCode()
and[0].keyCode()
-
Wait, um, after i added
print()
the pressesChange is not activating -
@yaley ok. And did you trace, sure that changed def is called?
Sorry: was typing while your previous post was coming
-
@cvp i dont think that that def was called :(
-
@yaley but do you really need it? The doc says it is called if you change something in your key press, like force. If you know which key is down and up, and when, you have all you need, haven't you?
-
Yep! Maybe…. No need!
-
@cvp But the main problem is just when arrow keys will happen, just like umm i give you an example:
I am detecting keys withui.Textfield()
And now i start pressing left arrow key. So in the input it goes left ( the selection bar ), but if the right arrow keys joined the right arrow key, the selection bar of input still goes left. -
And, also, can
vi.View().get_key_commands()
andui.View().key_command(sender)
detect keyup? if can, then i can make -
@cvp can it?
-
This post is deleted! -
@yaley sorry, was driving to France for some days, not able to answer
-
-
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?