Working With Owner-Drawn Headers in Desktop Windows Applications

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

When working with individual items of a header control, TestComplete needs to identify and specify them. For this purpose, it uses captions or indexes (started from 0). Using captions is prefered, because indexes may change during test runs. Furthermore, using captions makes scripts more readable.

Standard Windows controls are drawn by the operating system. However, the application can use the OWNERDRAW style for its controls, which means that the application can handle control drawing itself. Header items in working-with-owner-drawn header controls may not have labels and their contents can be arbitrary.

You can determine whether the specified item of the tested header control is working-with-owner-drawn using the IsOwnerDraw property of the Win32HeaderItemFormat helper object (see Determining Header Items' Format Settings in Desktop Windows Applications). It returns True if the specified header item is working-with-owner-drawn.

If the tested header control is working-with-owner-drawn, TestComplete identifies its individual items using indexes. This means that TestComplete records actions with working-with-owner-drawn header items using their indexes. When writing tests manually, you should also specify working-with-owner-drawn header items using indexes, for example:

HeaderObj.ClickItem(1)

To specify items 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.

See Also

Working With Header Controls in Desktop Windows Applications
Testing Owner-Drawn Controls
Win32 Header Support
IsOwnerdraw Property (HeaderItemFormat Objects)
Win32HeaderItemFormat Object

Highlight search results