I’m trying to programmatically set the KeyEquivalent and KeyEquivalentModifierMask for my NSMenuItem objects (in MonoMac). For alphanumeric keys (“a-z”, “0-9”) this is not a problem, but I do want to be able to set key equivalents for keys such as F1-F12 and also the arrow keys, return key, etc.
Is there a list of these keys available somewhere? This is the code I’m using currently for each key (found via Googling)
Enter/Return => @\"r"
Escape => @"\E"
Left Arrow => string.Format("%c", 0xF702)
Up Arrow => string.Format("%c", 0xF700)
Right Arrow => string.Format("%c", 0xF703)
Down Arrow => string.Format("%c", 0xF701)
Delete => string.Format("%c", 0x08)
F1 => ?
F2 => ?
...
F12 => ?
I haven’t tested all of these out yet.
They are defined in the NSKey enum.
If you want the values themselves they are in
NSEvent.hin the Mac OS X SDK (See apple documentation). The GnuStep version of this file could be found on Gna and should include the same constants, it’s easy to convert them to C# :