CheckItem Action (Specific to Win32TreeView Controls)

Applies to TestComplete 14.30, last modified on November 21, 2019

Description

The CheckItem action moves the mouse pointer to the specified tree view item and then checks or unchecks it. To learn the current state of an item, use the Checked property.

Declaration

TestObj.CheckItem(ItemState)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Item [in]    Required    Variant    
State [in]    Required    Variant    
Result None

Applies To

The method is applied to the following object:

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:

Item

Specifies the path to the desired item. The path should be relative to the current item or to the tree root, respectively. To indicate that the path starts from the tree root, place the pipeline character ( | ) at the beginning of the path.

Each item in the path can be specified by its caption or index; individual captions and indexes must be separated with pipeline characters ( | ). Indexes must be enclosed in brackets - [ and ].

To indicate variable parts of the item caption, you can use the asterisk (*) and question mark (?) wildcards. The asterisk corresponds to a string of any length, the question mark corresponds to any single character. The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting.

Note: If the item caption includes a bracket or a pipeline character, address the item by its index or with the question mark wildcard.

State

Specifies whether the item should be checked or unchecked. Possible values are:

Value Description
cbChecked, True or 1 The item will be checked.
cbUnchecked, False or 0 The item will be unchecked.

Result Value

None.

Remarks

The CheckItem action can be applied only to tree view controls that display check boxes (or custom state images) next to items. Such tree views have the TVS_CHECKBOXES style. If the tree view control does not have this style, or if the specified item is not found in the tree view, CheckItem fails and posts an error message to the test log. If the item is already in the specified state, the action does nothing.

Example

To view an example that demonstrates how to use the CheckItem action, see Checking and Unchecking Tree View Items.

See Also

ClickItem Action (TreeView Controls)
Check Action (TreeViewItem Objects)
Checked Property (TreeViewItem Objects)

Highlight search results