SelectItem Action (ListView Controls)

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

Description

Use the SelectItem action to select the specified item in the control.

Declaration

TestObj.SelectItem(Items, SelOption)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Items [in]    Required    Variant    
SelOption [in]    Optional    Boolean Default value: True   
Result None

Applies To

The method is applied to the following objects:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameters:

Items

Specifies the caption or zero-based index of the desired item. The caption could contain asterisk (*) or question mark (?) wildcards or regular expressions. The asterisk corresponds to a string of any length, the question mark corresponds to any single character. To specify more complicated parts of a caption, use regular expressions.

The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting.

If you enter -1, all items will be selected or deselected.

SelOption

Specifies whether the item will be selected or deselected.

Value Description
True, or 1 The Item will be selected.
False, or 0 The Item will be deselected.

Result Value

None.

Remarks

Unlike ClickItem or DblClickItem, SelectItem does not move the cursor. It sends selection messages to the control.

JFXListView: If the tested list view control does not support multiselection, SelectItem cannot select or deselect all the items. As a result, the action fails and posts an error message to the test log.

Example

To view an example that demonstrates how to use the SelectItem action, see Selecting List View Items in Desktop Windows Applications.

See Also

SelectItem Action (Specific to Win32ListView Controls)
MultiSelect Action (ListView Controls)
ClickItem Action (ListView Controls)
DblClickItem Action (ListView Controls)

Highlight search results