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

Applies to TestComplete 15.47, last modified on January 20, 2023

TestComplete can work with individual list view items and there is a robust way to identify them. Usually, TestComplete uses captions or indexes to identify and address items. Where possible, it uses item captions, because they make scripts more readable and stable. Indexes are less preferable since they can change during the test run (for example, after sorting the list view).

However, Windows supports owner-drawing of applications’ controls, including list views. This feature lets the application handle rendering of its controls itself instead of using the default rendering. Besides a custom appearance, owner-drawing lets the control have an arbitrary contents (for instance, non-text data). Because of this, TestComplete addresses items and subitems in owner-drawn list views using indexes. This means that TestComplete records actions with owner-drawn list views using item indexes. For example:

listViewObj.ClickItem(0)

When you write scripts or keyword tests that work with an owner-drawn list view, you should also address items by indexes. To learn whether your tested application owner draws its controls, ask the application’s developers.

To specify items of owner-drawn list 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 address list view items in the Win32ListView object’s actions, see Addressing List View Items and Subitems in Desktop Windows Applications.

See Also

Working With List View Controls in Desktop Windows Applications
Addressing List View Items and Subitems in Desktop Windows Applications
Working With Third-Party List View Controls in Desktop Windows Applications
Testing Owner-Drawn Controls

Highlight search results