I'm looking for a comprehensive list of the available key codes that can be used with Cocoa's NSEvent
class. The NSEvent
class has a keyCode
property, which is defined as unsigned short
. The following code, when placed in an appropriate UI object, will echo the key codes as they are pressed:
- (void)keyDown:(NSEvent *)theEvent
{
NSLog(@"%d", [theEvent keyCode]);
}
From this code, I can easily see which codes match certain keys, but I would like to find an official document somewhere that lists all of them. I expected Apple to have a header file somewhere that looked like this:
enum {
...
NSKeyCodeLeftArrow = 123,
NSKeyCodeRightArrow = 124,
...
};
But if there is one, I have yet to find it.