CheckItem Action (Specific to Win32, MFC ToolBar and MFC MenuBar Controls)

Applies to TestComplete 15.69, last modified on November 13, 2024
This method is not supported in web tests (including cross-platform web tests) that use XPath expressions and CSS selectors to locate web elements. This method can be only used in tests that locate web objects by using internal identification properties provided by TestComplete.

Description

CheckItem moves the mouse pointer to the control’s Item and then checks or unchecks this item.

Declaration

TestObj.CheckItem(Item, Checked, By Position)

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    
Checked [in]    Required    Boolean    
By Position [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:

Item

This parameter holds a string or an integer value that specifies the desired item. You can specify the item using item’s position in the control, ID or item’s caption. Which of this value is used depends on the combination of values of the Item and ByPosition parameters. See the Remarks section for more information.

Checked

Specifies whether the item should be checked (True) or unchecked (False).

By Position

Specifies whether the Item parameter specifies the position or id of the desired control’s item. For more information, see the Remarks section.

Result Value

None.

Remarks

You can specify the desired control’s item by assigning item’s caption, identifier or position on the control to the Item parameter. Therefore, if this parameter holds a string, TestComplete identifies the item by caption. When Item specifies the caption, you can use wildcards (* and ?) or regular expressions to mark variable parts of the caption. The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting. If Item holds an integer value, then TestComplete checks the ByPosition parameter to determine in what way to identify the item: if ByPosition is True, TestComplete treats the Item value as the item position; if ByPosition is False, TestComplete treats the Item value as an identifier.

If the specified item does not exist, CheckItem fails and posts an error message to the test log.

Use the CheckItem action to simulate user actions over those control’s items that have the TBSTYLE_CHECK (or BTNS_CHECK) style. To determine whether the item has this style, use the wIsCheckButton property. If item does not have the style, CheckItem will post an error message to the test log.

To determine whether an item is already in the checked (or unchecked) state, use the wChecked property.

Example

To view an example that demonstrates how to use the CheckItem action, see Selecting Toolbar Buttons.

See Also

Selecting Toolbar Buttons in Desktop Windows Applications
CheckItem Action (Specific to Mycrosoft, Infragistics, Syncfusion, and Telerik ToolBar Controls)
wChecked Property (Specific to Win32, MFC ToolBar and MFC MenuBar Controls)
wIsCheckButton Property (Specific to Win32, MFC ToolBar and MFC MenuBar Controls)
ClickItem Action (Specific to Win32, MFC ToolBar and MFC MenuBar Controls)
DblClickItem Action (Specific to Win32, MFC ToolBar and MFC MenuBar Controls)
wButtonPos Property (ToolBar and MenuBar Controls)
wButtonID Property (ToolBar and MenuBar Controls)
wButtonText Property (Specific to Win32, MFC ToolBar and MFC MenuBar Controls)

Highlight search results