Re: Menu item key equivalents
Re: Menu item key equivalents
- Subject: Re: Menu item key equivalents
- From: Eric Schlegel <email@hidden>
- Date: Mon, 3 May 2004 07:10:43 -0700
On May 3, 2004, at 6:24 AM, Bill Cheeseman wrote:
AXMenuItemCmdModifiers - The modifier key combination is a number
representing a particular combination of modifier keys, namely the
Modifier
Key Mask as documented in the Carbon Menu Manager. The number is based
on a
4-bit bit field where bit 0 is the Shift key, bit 1 is the Option key,
bit 2
is the Control key, and bit 3 means the Command key is not required,
counting from the least-significant bit. The Command key is assumed
(unless
bit 3 is set) and not included in the number. Thus, for example, the
number
0 means the Command key is required; 1, Command-Shift; 2,
Command-Option; 3,
Command-Shift-Option; 4, Command-Control; and so on.
Correct. The constants for this field are in Menus.h:
/* For use with Get/SetMenuItemModifiers*/
enum {
kMenuNoModifiers = 0, /* Mask for no modifiers*/
kMenuShiftModifier = (1 << 0), /* Mask for shift key
modifier*/
kMenuOptionModifier = (1 << 1), /* Mask for option key
modifier*/
kMenuControlModifier = (1 << 2), /* Mask for control key
modifier*/
kMenuNoCommandModifier = (1 << 3) /* Mask for no command key
modifier*/
};
AXMenuItemCmdGlyph - These are apparently glyph codes as described in
the
Carbon Menu Manager. However, I don't know where they are documented
or how
to interpret them.
See Menus.h:
/* For use with Get/SetMenuItemKeyGlyph*/
enum {
kMenuNullGlyph = 0x00, /* Null (always glyph 1)*/
kMenuTabRightGlyph = 0x02, /* Tab to the right key (for
left-to-right script systems)*/
kMenuTabLeftGlyph = 0x03, /* Tab to the left key (for
right-to-left script systems)*/
kMenuEnterGlyph = 0x04, /* Enter key*/
...
AXMenuItemCmdVirtualKey - I can't find any applications with
command-key
equivalents having this attribute. What is it?
Menu items may use virtual key codes (as documented in the original
Inside Mac documentation; for example, Inside Mac volume V, pg. V-192)
to specify the key that must be pressed to invoke that menu item.
From the Mac OS X 10.2.5 and
10.3 release notes, I'm guessing that these are the standard
hardware-independent keycode numbers.
Right.
I'm also guessing that the reason why I can't find applications that
generate this attribute is that most developers haven't yet caught up
with the fact that this is (apparently) now the preferred way to
implement keyboard shortcuts since Mac OS X 10.2.5.
Not really. This isn't the preferred way to implement keyboard
shoftcuts, but it is occasionally necessary. If you want to associate a
normal character with a menu item (like, 'A'), then you should still
use the character-code-based method of specified the command key,
because that allows the user to freely switch keyboard layouts and get
the expected behavior. Virtual keycode-based command keys should only
be used when you need to distinguish between multiple hardware keys
that generate the same character code; for example, all of the function
keys generate the same character, but they have different virtual
keycodes.
-eric
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.