Menu Item (MSAA UI Element Reference)

Note

This topic describes Menu Item objects for purposes of MSAA UI Element Reference. How to create Menu Item objects in various UI frameworks is not described here. See the API reference documentation for the UI framework you're using.

A menu item represents a particular item in a menu bar or pop-up menu. For example, Microsoft Active Accessibility creates a menu item object for the File menu in the menu bar. Similarly, Microsoft Active Accessibility creates a menu item object for the Open menu item from the File pop-up menu.

The window class name for a menu item is "#32768".

IAccessible Methods

A menu item supports the following IAccessible methods:

Method Comments
accDoDefaultAction For menu items from the menu bar, accDoDefaultAction either displays or closes the menu depending on the state of the menu. For menu items from a pop-up menu, accDoDefaultAction clicks the menu item to execute the menu command.
acchittest
accLocation
accNavigate
accSelect

IAccessible Properties

A menu item supports the following IAccessible properties:

Property Comments
get_accChild Retrieves the IDispatch interface to the pop-up menu object for this item.
get_accChildCount The ChildCount property is one for menu items that display a menu or submenu; otherwise the ChildCount property is zero.
get_accDefaultAction The DefaultAction property for menu items that display a menu or submenu is either "Open" or "Close" depending on the state of the menu. The DefaultAction property for all other menu items is "Execute".
get_accFocus
get_accKeyboardShortcut The KeyboardShortcut property is the menu item's access key, which is the underlined character in the text of the menu item's name. For example, the KeyboardShortcut property for theFile menu item is "f".
get_accName The Name property is the same as the name of the menu item.
get_accParent The Parent property is the menu bar or pop-up menu that contains the menu item.
get_accRole The Role property is ROLE_SYSTEM_MENUITEM.
get_accState The State property is either STATE_SYSTEM_INVISIBLE or a combination of one or more of the following values: STATE_SYSTEM_UNAVAILABLE | STATE_SYSTEM_CHECKED | STATE_SYSTEM_DEFAULT | STATE_SYSTEM_HOTTRACKED | STATE_SYSTEM_FOCUSED | STATE_SYSTEM_HASPOPUP

Notes

  • When used on a menu item, accDoDefaultAction returns S_OK but fails to perform the action if the character used in the access key is ?, !, @, or any other character that requires the SHIFT key or another modifier key. This also happens on international keyboards with an access key character that requires the ALT GR key to be pressed.
  • The accSelect method with SELFLAG_TAKEFOCUS does not cause a menu item to open or close a pop-up menu. Clients use the accDoDefaultAction method to open or close a pop-up menu.
  • A menu bar item that does not display a pop-up menu returns "Application" for the Name property instead of the name of the menu item.

IAccessible Interface

Menu Bar

Pop-up Menu