Working With Tree View Controls in Desktop Windows Applications

Applies to TestComplete 15.70, last modified on December 17, 2024

Applications use tree view (TreeView) controls to display a hierarchical list of items such as index entries, directories and files, and so on. Each tree view item can have a list of child items that are displayed below this item. A user can navigate through the tree view by selecting, expanding and collapsing items as well as modifying tree data by editing item labels, checking and unchecking items and rearranging them.

With TestComplete, you can record and play back various kinds of user actions over tree view controls. TestComplete provides a number of program objects that let you work with various types of tree views:

  • Win32TreeView - Provides a scripting interface to Win32 tree views.
  • JTree - Provides a scripting interface to Java Swing tree views.
  • WPFTreeView - Provides scripting access to WPF (XAML) tree views.

TestComplete associates tree view controls in the tested application with one of mentioned scripting objects by analyzing the application type and the controls’ class names. Class names of supported “standard” tree views are listed in the project’s Object Mapping options. If your tested application uses a tree view control that is inherited from a standard tree view, you can add its class name to the Object Mapping list and thus make TestComplete handle it as the standard control (including the recording and scripting support). For more information, see Object Mapping.

The topics of this section provide detailed information about working with tree view controls in TestComplete and contain script samples that illustrate the explanation. The information in these topics applies to standard Win32 controls, however most are valid for Java Swing and WPF controls as well, since the TestComplete support for these controls is very similar.

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 Tree View Controls - Basic Concepts in Desktop Windows Applications

Describes general principles of working with tree view controls in TestComplete.

Addressing Tree View Items in Desktop Windows Applications

Explains how to access individual tree view items and address them in actions parameters.

Selecting Tree View Items in Desktop Windows Applications

Explains how you can select individual tree view items from tests.

Getting the Current Tree View Item in Desktop Windows Applications

Describes how to determine the tree view item that is currently focused.

Getting Selected Tree View Items in Desktop Windows Applications

Explains how you can get the list of selected items in multi-select tree views.

Expanding and Collapsing Tree View Items in Desktop Windows Applications

Explains how you can expand and collapse tree view items from tests.

Checking and Unchecking Tree View Items in Desktop Windows Applications

Explains how you can record checking and unchecking of tree view items and simulate these actions from tests.

Checking Tree View Items' State in Desktop Windows Applications

Describes how to determine the current state of tree view items.

Changing Tree View Items' Captions in Desktop Windows Applications

Explains how you can create a test that modifies the tree view item’s caption.

Getting Tree View Item's Images in Desktop Windows Applications

Describes how you can obtain and work with images displayed next to tree view items.

Working With Owner-Drawn Tree View Controls in Desktop Windows Applications

Describes the specifics of working with owner-drawn tree view controls.

Working With Third-Party Tree View Controls in Desktop Windows Applications

Explains how you can work with Java Swing and WPF tree views as well as third-party tree view controls.

Retrieving TreeView Items. Example in Desktop Windows Applications

Contains a sample script that demonstrates how you can export the tree view items’ data to a file.

Related Topics of Interest

Working With List View Controls in Desktop Windows Applications

Explains how you can simulate actions over list view controls with TestComplete.

Simulating User Actions

Explains the most common approaches for simulating user actions over applications’ controls.

See Also

Win32 TreeView Support
WPF TreeView Support
Java Swing Tree Support
Object-Specific Tasks
Supported Controls

Highlight search results