Cocoa has a plethora of integer masks and codes. For instance, NSCommandKeyMask or NSF1FunctionKey, which are clearly defined and documented in the headers.
However, some can be archaic and when accessing accessibility attributes, for instance to get the glyph (AXMenuItemCmdGlyph), you're given an integer number like 111, which represents F1 (0xf704), or 112 which represents F2 (hex: 0xf705).
Is there an easy way to deal with masks and codes? Perhaps one that's able to convert the 111 into the corresponding hex unicode 0xf704? What I mean is that NSEvent.h maps NSF1FunctionKey to 0xf704, but is there a mapping for 111 to NSF1FunctionKey or 0xf704?
If you want the Unicode character for the menu item's key equivalent, rather than the glyph for it, try getting the kAXMenuItemCmdCharAttribute
attribute instead of kAXMenuItemCmdGlyphAttribute
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With