objective c - Convert OS X keycodes to key location? (irrespective of system keyboard language/layout) -
I have to find out where a pressed key on the Mac keyboard is physically, seeing the keycode gives me four more . But there is no space, which varies according to the language / keyboard layout. I wanted something like the row index for the key.
I can see the keyboard layout language using this code:
TISInputSourceRef source = TISCopyCurrentKeyboardInputSource (); NSLog (@ "Localized Name:% @", TISGetInputSourceProperty (Source, KatispropertyLocaledName));
From which I can map the location through the creation of keycode place dictionaries for each language, but it can be a lot to cover most keyboards.
Shortcut?
You are wrong about the key code. On OS X, the virtual key code corresponds to the key position. This not indicates which characters will be generated by the keyboard layout. For example, the key code is 0 kVK_ANSI_A
. What does it mean not is a key that generates "A" character, it means that it is a condition that "A" key is on the ANSI standard keyboard.
When a key code is not a modifier through the Finnish keyboard layout, it generates a "Q" character.
Comments
Post a Comment