wItemSelected Property (Specific to iOS TableView Controls)

Applies to TestComplete 14.40, last modified on April 22, 2021

Description

Use the wItemSelected property to determine whether an item is selected or not.

Declaration

TestObj.wItemSelected(SectionItem)

Read-Only Property Boolean
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Section [in]    Required    Variant    
Item [in]    Required    Variant    

Applies To

The property is applied to the following object:

View Mode

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

Parameters

The property has the following parameters:

Section

Specifies the section of the desired item. You can enter the section’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.

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.

Property Value

True if the specified item is selected; False otherwise.

Remarks

If you use Python or DelphiScript, you should enclose the parameter of the wItemSelected property in square brackets: wItemSelected[Item].

Example

The following example gets the properties of all TableView items and posts them to the log:

JavaScript, JScript

function Test()
{
  // Select the mobile device
  Mobile.SetCurrent("iPhone");
  // Obtain the TableView object
  var p = Mobile.Device().Process("SampleApp");
  var tableview = p.Window().TableView();
  
  for (var i = 0; i<tableview.wSectionCount; i++)
  {
    Log.Message(tableview.wSection(i));
    for (var n = 0; n<tableview.wItemCount(i); n++)
    {
      Log.Message(tableview.wItem(i, n));
      Log.Message(tableview.wItemDetail(i, n));
      Log.Message(tableview.wItemSelected(i, n));
    }
  }
}

Python

def Test():
  # Select the mobile device
  Mobile.SetCurrent("iPhone")
  # Obtain the TableView object 
  p = Mobile.Device().Process("SampleApp")
  tableview = p.Window().TableView()
  
  for i in range (0, tableview.wSectionCount):
    Log.Message(tableview.wSection[i])
    for n in range (0, tableview.wItemCount[i]):
      Log.Message(tableview.wItem[i, n])
      Log.Message(tableview.wItemDetail[i, n])
      Log.Message(tableview.wItemSelected[i, n])

VBScript

Sub Test()
  Dim p, tableview
  ' Select the mobile device
  Mobile.SetCurrent("iPhone")
  ' Obtain the TableView object
  Set p = Mobile.Device.Process("SampleApp")
  Set tableview = p.Window().TableView()
  
  For i = 0 To tableview.wSectionCount-1
    Log.Message(tableview.wSection(i))
    for n = 0 To n<tableview.wItemCount(i)-1
      Log.Message(tableview.wItem(i, n))
      Log.Message(tableview.wItemDetail(i, n))
      Log.Message(tableview.wItemSelected(i,n))
    Next
  Next
End Sub

DelphiScript

procedure Test();
var
  p, tableview, i, n;
begin
  // Select the mobile device
  Mobile.SetCurrent('iPhone');
  // Obtain the tableview object
  p := Mobile.Device.Process('SampleApp');
  tableview := p.Window(0).TableView(0);
  
  for i := 0 to tableview.wSectionCount-1 do
  begin
    Log.Message(tableview.wSection(i));
    for n := 0 to tableview.wItemCount(i)-1 do
      begin
      Log.Message(tableview.wItem(i, n));
      Log.Message(tableview.wItemDetail(i, n));
      Log.Message(tableview.wItemSelected(i, n));
      end;
  end;
end;

C++Script, C#Script

function Test()
{
  // Select the mobile device
  Mobile["SetCurrent"]("iPhone");
  // Obtain the TableView object
  var p = Mobile["Device"].Process("SampleApp");
  var tableview = p["Window"]()["TableView"]();
  
  for (var i = 0; i<tableview["wSectionCount"]; i++)
  {
    Log["Message"](tableview["wSection"](i));
    for (var n = 0; n<tableview["wItemCount"](i); n++)
    {
      Log["Message"](tableview["wItem"](i, n));
      Log["Message"](tableview["wItemDetail"](i, n));
      //Log["Message"](tableview["wItemSelected"]);
    }
  }
}

See Also

Working With Table View Controls - Basic Concepts
wItemCount Property (Specific to iOS TableView Controls)
wSectionCount Property (Specific to iOS TableView Controls)

Highlight search results