Working With Menus

Applies to TestComplete 14.0, last modified on January 23, 2019

Most applications have the menu system that provide a list of commands a user can perform. Each window typically has several types of menus associated with it: a top-level window may have the system menu, the main menu and the context menu, and a control may have a context menu as well:

  • Main menu is usually displayed under the window’s title bar and provides access to the list of all commands available to the user that are grouped by categories.
  • System menu is invoked upon clicking the window’s icon on the left of the title bar. It contains commands for managing the window -- moving, resizing and closing it. System menus can also hold custom commands, for example, for navigating between application’s windows.
  • Context menu is shown for the selected object or control by right-clicking it, and holds items specific to the current context. Context menus are also called popup menus or shortcut menus.

TestComplete can record and play back user actions over menus. It provides the Menu program object which lets you work with various kinds of menus. The topics of this section provide detailed information about working with menu controls in TestComplete and contain script samples that illustrate the explanation.

Note: Though the following topics deal with scripts, you can use the same approaches while testing an application from your keyword tests. For more information, see Keyword Tests Basic Operations.

In This Section

Working With Menus - Basic Concepts

Describes general principles of working with menu controls in TestComplete.

Displaying Context Menus

Describes how you can display a context menu for windows and controls.

Addressing Menu Items

Explains how you can access and address individual menu items.

Selecting Menu Items

Explains how to select menu items from tests.

Checking Menu Item's State

Describes how you can determine if a menu item is enabled or disabled.

Working With Owner-Drawn and Bitmap Menus

Describes the specifics of working with owner-drawn and bitmap menus.

Working With Third-Party Menus

Explains how you can work with menus created using third-party menu components.

Samples

The following topics contain sample scripts that perform common operations over menus:

Selecting Menu Items

Demonstrates how to select an item in the application’s main menu.

Checking Menu Items

Demonstrates how you can check items in the application’s main menu.

Pasting Text via the Context Menu

Demonstrates how you can paste the control’s text from clipboard using the context menu.

Related Topics of Interest

Working With Toolbars

Explains how you can work with toolbar controls in TestComplete.

Simulating Menu Actions

Provides a brief overview of scripting objects and routines used to simulate actions over menus.

See Also

Menu Object
Recording Specifics
Supported Controls
Simulating User Actions

Highlight search results