In V1 it looks as if the
key field in a
SelectKeyEvent is ascii, but it does not reflect the OS settings. So when I press the key labeled
a on my keyboard, I get a code of
65. But if I change the language of my keyboard to French, it still send me
65, even though that key is not
a on a French keyboard.
I seem the the text events do use the OS keyboard settings, but the key events do not. Is that the case?
I believe this is how it works in the underlying GLFW (and, SDL does it this way as well.) You get the scancode for the key, not the localized meaning of said key.
with v1 you get the
scancode, but you also get a new field
code. The thing that I’m asking about is basically - the VCV “Notes” module lets you type into it with a French keyboard mapping, and it respects that. Hence my thread that the text family of events use the OS settings, but the key family events does not.
So the high level question is “can my keyboard shortcuts based on key events use the localized keyboard just like the Notes module does”?
You can access both the
key (the label on the keyboard) and the
scancode (what your operating system remaps it to).
You should use
onSelectTextEvent() if you want keys. Don’t try to interpret
onSelectKeyEvent() as ASCII characters, or it’ll be wrong on some platform somewhere.
Yes, but the text events are only fired for “text” keys, aren’t they? I didn’t think they fired for cursor key, or things like ],[, which are what I need. But maybe I better check again.
SelectKeyEvent for cursor keys.