Partager via


Menu Item

A menu item represents a particular item in a menu bar or pop-up menu. For example, Active Accessibility creates a menu item object for the File menu in the menu bar. Similarly, 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".

Supported Properties and Methods

  • accDoDefaultAction
    For menu items from the menu bar, DoDefaultAction either displays or closes the menu depending on the state of the menu. For menu items from a pop-up menu, DoDefaultAction clicks the menu item to execute the menu command.

  • accHitTest
    accLocation
    accNavigate
    accSelect
    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 the File 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

Events Generated

None

Remarks

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.

See Also

IAccessible Interface Menu Bar, Pop-up Menu