Is there a table or some kind of utility with which I can find the CGKeyCode of a key? Thanks
Asked
Active
Viewed 2,113 times
2 Answers
6
- (void)keyDown:(NSEvent *)theEvent {
NSLog(@"keycode: %hu", [theEvent keyCode]);
}

Dave DeLong
- 242,470
- 58
- 448
- 498
2
To get them one at a time:
- (void)keyDown:(NSEvent *)theEvent {
CGEventRef cgEvent = [theEvent CGEvent];
NSLog(@"%hu", CGEventGetIntegerValueField(cgEvent, kCGKeyboardEventKeycode));
}
They also seem to be listed in Events.h.

jscs
- 63,694
- 13
- 151
- 195