Working With Owner-Drawn Tree View Controls

Applies to TestComplete 14.60, last modified on April 22, 2021

In order for TestComplete to work with individual tree view items in scripts or keyword tests, it needs a way to identify and specify them. For this purpose, TestComplete uses either item labels or indexes. Labels are preferred over indexes, because they make tests more readable and stable, whereas indexes are less easy to understand and, moreover, they may change during the run.

Standard Win32 controls are drawn by the operation system itself. However, Windows also lets applications handle drawing their controls, including tree views, in a custom way. The controls drawn by the application are called owner-drawn. In general, items in owner-drawn tree views may have no labels and their contents can be arbitrary. To learn whether your tested application owner draws its controls, ask the tested application developers.

If the tree view control is owner-drawn, TestComplete identifies its items using indexes. This means that TestComplete records actions with owner-drawn tree views using item indexes. When writing tests for testing owner-drawn tree views manually, you should also specify items by indexes. For example:

treeObj.ClickItem(0)

treeObj.ClickItem("[0]|[2]")

treeObj.wItems.Item(3).Click()

To specify items of owner-drawn tree views by text, try using the appropriate approaches described in the Object Identification section. For other tips on dealing with non-standard controls, see Ways to Interact With Application Objects.

For more information on how to specify tree view items in action parameters, see Addressing Tree View Items.

See Also

Working With Tree View Controls
Testing Owner-Drawn Controls
Working With Third-Party Tree View Controls
Addressing Tree View Items

Highlight search results