Questions tagged [cgkeycode]

5 questions
100
votes
8 answers

Where can I find a list of Mac virtual key codes?

I'm using CGEventCreateKeyboardEvent and need to know what CGKeyCode values to use. Specifically, I am after the key code for the Command key. The docs give examples for other keys: z is 6, shift is 56. There must be a list of Mac virtual keycodes…
Nick Moore
  • 15,547
  • 6
  • 61
  • 83
4
votes
2 answers

Convert CGKeyCode to character

I have not been able to find out how to convert a CGKeyCode to the corresponding character. So how do you do it?
Tyilo
  • 28,998
  • 40
  • 113
  • 198
2
votes
1 answer

Converting CGKeyCodes for International Keyboards

In my application, I need to map a shortcut to the key to the left of the "1" key on the keyboard. On a standard US keyboard, this would be the backtick character (" ` "), which is key code number 50. Unfortunately, international keyboards (the…
indragie
  • 18,002
  • 16
  • 95
  • 164
1
vote
2 answers

CGKeyCode table

Is there a table or some kind of utility with which I can find the CGKeyCode of a key? Thanks
user635064
  • 6,219
  • 12
  • 54
  • 100
1
vote
0 answers

How to get the "name" of a CGKeyCode?

I need to display a CGKeyCode in a user-readable way. Here is an example: For characters and letters: 0 -> "a" 18 -> "1" For specific keys: 49 -> "Space" 83 -> "Numpad 1" 80 -> "F19" Depending on the keyboard layout the names will have to change.…
Afterlame
  • 1,188
  • 2
  • 13
  • 32