Description
The CheckItem
moves the mouse cursor to the specified item in a check list box control and sets its state (checked, unchecked or grayed). To check current state of the specified item, use the wItemState
property.
Declaration
TestObj.CheckItem(Item, State)
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 objects:
View Mode
This method is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.
Parameters
The method has the following parameters:
Item
Specifies the desired item. You can enter the item’s index (from 0) or its caption. The caption can contain asterisk (*) or question mark (?) wildcards 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.
The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting.
State
Specifies the state of the item. There are three possible states for each of items in a check list box control. To set the state of the specified item, the following constants can be used in the State parameter:
Value | Description |
---|---|
cbUnchecked , False or 0 |
The item becomes unchecked. |
cbChecked , True or 1 |
The item becomes checked. |
cbGrayed or 2 |
The item becomes switched to grayed (indeterminate state). |
Result Value
None.
Remarks
If the State parameter corresponds to the item’s current state (for example, State is cbChecked
and the item is already checked), CheckItem
performs no action. To toggle the item’s state without moving the mouse pointer, use wItemState
property.
Note that the items of the check list box may be in the indeterminate (grayed) state only if the list box’s AllowGrayed
property is True. Otherwise, the items does not support the indeterminate state. In this case, if you pass cbGrayed
to the State parameter, CheckItem
will fail and post an error message to the test log.
See Also
wItemState Property (Specific to CheckedListBox and CheckListBox Controls)
wItem Property (ListBox Controls)
wItemCount Property (ListBox Controls)
wSelected Property (ListBox Controls)