TreeView Class

Description

TreeView is the class for items which are organized into graphical hierarchies.

TreeView supports hierarchical views. For non-hierarchical views, see the ListView class. In Windows, the class corresponds to the TreeView control.

Inheritance

TreeView derives from the Control class; no classes derive from this class.

Identification of TreeView Items

In TreeView methods, you can identify items in a TreeView control by path, by index, or by a combination of both path and index.

Identification of Items by Path

An item path represents the hierarchical path from the root of the TreeView to a specific item. You can uniquely identify each item in the hierarchical path by specifying one or more of its attributes.

Items in a TreeView have the following attributes:

  • The hierarchical relationship between the item and other items.
  • The title or caption of the item.
  • The ordinal number of the item in relation to its siblings.
  • The ordinal number of the item in a flat view of the TreeView.

Identification of Items by Index

An item index is the ordinal number of the item relative to the other currently viewable (non-hidden) items in the entire TreeView list. A flat item index is useful for writing non-recursive functions that traverse the TreeView. You can specify an index either as an INTEGER or as a STRING of the form "#n" where n is the numerical index of the item.

Note: Do not use '/n#' where n is a number as part of a TreeView item name. This is the separator used to find each of the TreeView segments.

Operation on Hidden Items

As with other windows and controls, a TreeView item is defined only if it is visible (that is, it is not hidden by a collapsed ancestor). Silk Test Classic does not operate on hidden items. Since applications often maintain only viewable items, the contents of hidden branches of a TreeView may be undefined.

The contents returned for a TreeView, and the ability to select an item in the TreeView, depends on the current expand/collapse state of the items.

Examples of Identifying Items

The following examples show how you can identify unique items within a TreeView by path, index, or a combination of both.

This Specification... Identifies This Item...
"Games" An item "Games" that exists at any level, but which is unique among all currently viewable items in the entire TreeView. Supported on the Classic Agent only.
"#23" The 23rd currently viewable item in the entire TreeView.
24 The 24th currently viewable item in the entire TreeView.
"Games/Sub1/Sub2" An item "Sub2" under an item "Sub1" under an item "Games" with unspecified ancestry. Supported on the Classic Agent only.
"/Desktop/Applications/Games" A unique item "Games" under a unique item "Applications" under a unique item "Desktop" at the outer level of the TreeView.

"/Desktop/#2/#4"

The fourth item under the second item under a unique item "Desktop" at the outer level of the TreeView.

"/Desktop/Applications#2/Games"

A unique item "Games" under the second item with the text "Applications" under a unique item "Desktop" at the outer level of the TreeView. Supported on the Open Agent only.

Notes

You can manipulate Java tree view items containing a forward slash by substituting the ? wildcard for the forward slash when you call tree view item methods such as GetSelText(), Select (), and FindItem().

Window does not support extended-selection and multiple-selection TreeView.

Methods and Properties

For information about a particular property, prefix the property name by "Get" and look in the list of "Methods". For example, if you are looking for information about SelIndex, look under GetSelIndex.

In addition to the methods and properties it inherits from the AnyWin class and Control class, TreeView has the following methods and properties: