Working With List View Controls - Basic Concepts

Applies to TestComplete 14.71, last modified on April 22, 2021
General Notes

With TestComplete, you can record and simulate actions over list view controls in Windows applications. Standard list view controls are associated with the Win32ListView object, and TestComplete uses various methods provided by this object (such as ClickItem, DblClickItem and other) when recording actions over list views. The Win32ListView object’s properties allow you to retrieve data from the list view and check an item’s properties. For instance, the wSelectedItems property returns the selected items list, and so on. For more information on available actions, see the object description and Working With List View Controls.

In addition to standard list view controls, TestComplete supports WPF (XAML) list views and works with them via the WPFListView object. TestComplete also provides some useful techniques that let you interact with third-party list view controls and retrieve their data. For more information, see Working With Third-Party List View Controls.

Specifics of Working With ListView Controls

Recording of actions over list view controls has the following specifics:

  • As it was already mentioned, TestComplete records user actions over list view items using special scripting instructions. For instance, clicks on list view items are recorded as ClickItem actions, double-clicks are recorded as DblClickItem actions, right-clicks - as ClickItemR actions, and so on.

    Checking and unchecking of check boxes are recorded as CheckItem actions.

  • In the recorded test, TestComplete usually uses the items' captions and subitems rather than indexes, because this makes the test more readable.

  • If the list view control is owner-drawn, actions over items and subitems are recorded using their indexes. See Working With Owner-Drawn List View Controls.

  • Drag operations are recorded as OnscreenObject.Drag actions using coordinates of the start dragging point and the dragging distance, relative to the list view control.

For more information on the specifics of recording in TestComplete, see Recording Specifics.

During playback, the Win32ListView object uses the following principles for simulating user actions over list view controls:

  • In properties and methods of the Win32ListView object, you can specify the desired list view item or subitem using its index or caption. When specifying the item caption, you can use wildcard characters (* and ?) or regular expressions. The asterisk (*) corresponds to a string of any length (including an empty string), the question mark corresponds to any single character (including none). To specify more complicated parts of a caption, use regular expressions.

    In addition, TestComplete can treat the item captions as case-sensitive or case-insensitive depending on the Use case-sensitive parameters project setting (you can change it on the Properties page of your project’s editor). For more information, see Addressing List View Items and Subitems.

  • All actions that simulate mouse and keyboard actions (such as Win32ListView.ClickItem, Win32ListView.HotTrackSelect, OnscreenObject.Keys and others) first activate the window that contains the list view control. There is no need to simulate additional actions that restore the window from the minimized state, bring it to the front, and so on.

  • If the target list view item is situated out of the visible list view area, the control is automatically scrolled so that the item becomes visible. There is no need to simulate additional actions that would scroll the list view to the needed item.

Specifics of Working With ListView Controls Using Windows XP

Due to specifics of list view controls' functioning on Windows XP, TestComplete cannot simulate actions over subitems when these controls display information in Tile mode. If this happens, consider simulating mouse clicks over the first subitem only. That is typically enough for selecting the item. If it is important to click a subitem other than the first one, record and run your test on a later operation system (Windows 7, Windows 8 and so on).

See Also

Working With List View Controls
Object-Specific Tasks
Win32 ListView Support
WPF ListView Support
Simulating User Actions
Supported Controls

Highlight search results