MenuBar Control Type
This topic provides information about Microsoft UI Automation support for the MenuBar control type.
Menu bar controls are an example of controls that implement the MenuBar control type. Menu bars provide a means for users to activate commands and options contained in an application.
The following sections define the required UI Automation tree structure, properties, control patterns, and events for the MenuBar control type. The UI Automation requirements apply to all menu bar controls where the UI framework/platform integrates UI Automation support for control types and control patterns.
This topic contains the following sections.
Typical Tree Structure
The following table depicts a typical control and content view of the UI Automation tree that pertains to menu bar controls and describes what can be contained in each view. For more information about the UI Automation tree, see UI Automation Tree Overview.
Control View | Content View |
---|---|
|
|
A menu bar control always appears in the control view, but not in content view because it usually does not convey meaningful information to the end user (unless the application contains more than one menu bar).
UI Automation clients can listen for the UIA_MenuModeStartEventId event to ensure that they are consistently notified when the UI enters menu mode. When the application is in menu mode, all of the keyboard input may be captured for menu navigation (for example, typing 's' might invoke the Save menu instead of typing the character on the application client area). The UIA_MenuModeStartEventId event must precede the first UIA_MenuOpenedEventId event to ensure logical consistency. The UIA_MenuModeEndEventId event follows the last UIA_MenuClosedEventId event. Clicking a menu item may also immediately trigger the UIA_MenuModeStartEventId event, followed by a UIA_MenuOpenedEventId event.
A menu bar control can contain other controls, such as edit controls and combo boxes, within its structure. These additional controls correspond to the "other controls" listed above in the control and content views.
Relevant Properties
The following table lists the UI Automation properties whose value or definition is especially relevant to the MenuBar control type. For more information about UI Automation properties, see Retrieving Properties from UI Automation Elements.
UI Automation Property | Value | Notes |
---|---|---|
UIA_AcceleratorKeyPropertyId | NULL | Menu bars usually do not have accelerator keys. |
UIA_AccessKeyPropertyId | "ALT" | Pressing the ALT key should usually bring focus to the menu bar within the application. |
UIA_BoundingRectanglePropertyId | See notes. | The value exposed by this property must include all of the controls contained within it. |
UIA_ControlTypePropertyId | MenuBar | |
UIA_IsContentElementPropertyId | FALSE | The menu bar control is not included in the content view of the UI Automation tree. |
UIA_IsControlElementPropertyId | TRUE | The menu bar control is always included in the control view of the UI Automation tree. |
UIA_IsKeyboardFocusablePropertyId | TRUE | Menu bar controls are keyboard-focusable because the controls they contain can take keyboard focus. |
UIA_IsOffscreenPropertyId | See notes. | The value of this property depends on whether the control is viewable on the screen. |
UIA_LabeledByPropertyId | NULL | Menu bar controls usually do not have a label. |
UIA_LocalizedControlTypePropertyId | See notes. | Localized string corresponding to the MenuBar control type. The default value is "menu bar" for en-US or English (United States). |
UIA_NamePropertyId | See notes. | The menu bar control does not need a name unless an application has more than one menu bar. If there is more than one menu bar in an application, use this property to expose distinguishing names, such as "Formatting" or "Outlining". |
UIA_OrientationPropertyId | Depends | This property exposes whether the menu bar control is horizontal or vertical. |
Required Control Patterns
The following table lists the UI Automation control patterns required to be supported by menu bar controls. For more information on control patterns, see UI Automation Control Patterns Overview.
Control Pattern | Support | Notes |
---|---|---|
IExpandCollapseProvider | Depends | If the control can be expanded or collapsed, it must implement the ExpandCollapse control pattern. |
IDockProvider | Depends | If the control can be docked to different parts of the screen, it must implement the Dock control pattern. |
ITransformProvider | Depends | If the control can be resized, rotated, or moved, it must implement the Transform control pattern. |
Required Events
The following table lists the UI Automation events that menu bar controls are required to support. For more information on events, see UI Automation Events Overview.
UI Automation Event | Notes |
---|---|
UIA_AutomationFocusChangedEventId | |
UIA_BoundingRectanglePropertyId property-changed event. | |
UIA_ExpandCollapseExpandCollapseStatePropertyId property-changed event. | If the control supports the ExpandCollapse control pattern, it must support this event. |
UIA_IsEnabledPropertyId property-changed event. | If the control supports the IsEnabled property, it must support this event. |
UIA_IsOffscreenPropertyId property-changed event. | If the control supports the IsOffscreen property, it must support this event. |
UIA_StructureChangedEventId |
Related topics