Handling non-text key on non-US keyboards?

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.

Correct.

Then use SelectKeyEvent for cursor keys.

Yes, I see now. tx.

Hi, please can you write here a simple code/example to capture correctly a character/number/symbol/spacebar typed on keyboard (and/or scancode), localized keyboard layout (QWERTY, AZERTY), OS independent, non UTF-8, because I’m totally lost on how I can access to KeyBaseEvent scancode and keyName properties.

Many thanks in advance.

void onSelectText(const SelectTextEvent& e) override {
		if (module) {
				?????
		}
}

I don’t know how I can use this. API v2 doc really doesn’t help.

I precise mouse events (over the TransparentWidget => touchscreen-like display) such onEnter, onLeave, onHover… are working without any issue (and smart to code). Keypress is a pain.

onHoverKey isn’t user friendly because by pressing “A” (on AZERTY keyboard), it returns Q, and so on for Z, W, A, etc.

Also, I cannot use BACKSPACE key (to rub last entered char) because… it deletes the module, e.consume(this) seems unefficient, I can’t find the way to filter this specific e.key property if equals GLFW_KEY_BACKSPACE (and can’t modify e.key because it’s a read-only property) to prevent module deletion.