ClickItem Action (Specific to XULTree Controls)

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

XUL tree can combine tree view and grid controls. The ClickItem action moves the mouse pointer to the item specified by Item in the Column column and then simulates a single click of the left mouse button over this item.

Declaration

TestObj.ClickItem(Item, Column, Shift)

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    
Column [in]    Optional    Variant Default value: 0   
Shift [in]    Optional    TShiftKey Default value: skNoShift   
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 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.

Column

This parameter specifies the column where a click will be performed. It can be an item's caption, or the column's index (from 0). If it is omitted, the default value is 0, that is click actions will be performed over the items of the first column of the XUL tree control.

Shift

Specifies whether the CTRL, ALT or SHIFT keys will be pressed during the click. The default value is skNoShift (no shift key pressed). See TShiftKey.

Result Value

None.

Example

The following example demonstrates how to use the ClickItem method. Suppose you have a XUL tree control, MyXULTree, that has a structure as shown in the figure below.

A XUL tree structure

The XUL tree control combines the functionality of a typical tree view control and grid, that is it can have expandable rows. To perform a click on a certain tree item, you should specify an item (actually, a row where the specified item resides), and the column where a click will be performed.

There are several ways to click the desired XUL tree item. Assume, you need to click the items named SubItem1.2.1 and SubItem2.2.1, which reside in different columns of the same row (the first subitem of the second subitem of the first root item).

  • Use the indexes of root items and their subitems:

    JavaScript, JScript

      // Clicks SubItem 1.2.1
      MyXULTree.ClickItem("|[0]|[1]|[0]", 0);
      // Clicks SubItem 2.2.1
      MyXULTree.ClickItem("|[0]|[1]|[0]", 1);

    Python

      # Clicks SubItem 1.2.1
      MyXULTree.ClickItem("|[0]|[1]|[0]", 0)
      # Clicks SubItem 2.2.1
      MyXULTree.ClickItem("|[0]|[1]|[0]", 1)

    VBScript

      ' Clicks SubItem 1.2.1
      MyXULTree.ClickItem "|[0]|[1]|[0]", 0
      ' Clicks SubItem 2.2.1
      MyXULTree.ClickItem "|[0]|[1]|[0]", 1

    DelphiScript

      // Clicks SubItem 1.2.1
      MyXULTree.ClickItem('|[0]|[1]|[0]', 0);
      // Clicks SubItem 2.2.1
      MyXULTree.ClickItem('|[0]|[1]|[0]', 1);

    C++Script, C#Script

      // Clicks SubItem 1.2.1
      MyXULTree.ClickItem("|[0]|[1]|[0]", 0);
      // Clicks SubItem 2.2.1
      MyXULTree.ClickItem("|[0]|[1]|[0]", 1);

  • Use the captions of root items and their subitems:

    JavaScript, JScript

      // Clicks SubItem 1.2.1
      MyXULTree.ClickItem("|TopItem1|SubItem1.2|SubItem1.2.1", 0);
      // Clicks SubItem 2.2.1
      MyXULTree.ClickItem("|TopItem1|SubItem1.2|SubItem2.2.1", 1);

    Python

      # Clicks SubItem 1.2.1
      MyXULTree.ClickItem("|TopItem1|SubItem1.2|SubItem1.2.1", 0)
      # Clicks SubItem 2.2.1
      MyXULTree.ClickItem("|TopItem1|SubItem1.2|SubItem2.2.1", 1)

    VBScript

      ' Clicks SubItem 1.2.1
      MyXULTree.ClickItem "|TopItem1|SubItem1.2|SubItem1.2.1", 0
      ' Clicks SubItem 2.2.1
      MyXULTree.ClickItem "|TopItem1|SubItem1.2|SubItem2.2.1", 1

    DelphiScript

      // Clicks SubItem 1.2.1
      MyXULTree.ClickItem('|TopItem1|SubItem1.2|SubItem1.2.1', 0);
      // Clicks SubItem 2.2.1
      MyXULTree.ClickItem('|TopItem1|SubItem1.2|SubItem2.2.1', 1);

    C++Script, C#Script

      // Clicks SubItem 1.2.1
      MyXULTree.ClickItem("|TopItem1|SubItem1.2|SubItem1.2.1", 0);
      // Clicks SubItem 2.2.1
      MyXULTree.ClickItem("|TopItem1|SubItem1.2|SubItem2.2.1", 1);

See Also

ClickItemR Action (Specific to XULTree Controls)
ClickItemM Action (Specific to XULTree Controls)
DblClickItem Action (Specific to XULTree Controls)

Highlight search results