## The `Getinfo' method

Argument: Two- or three-element nested vector
Result: See text

Valid for: Tree

The `Getinfo` method returns information about one or more nodes in the tree.

The first argument is a character vector giving the attribute name you are interested in, one of: `'forceparent'` `'highlightbold'` `'highlightcut'` `'highlightdrop'` `'highlightselect'` `'expanded'` `'expandedonce'` `'haschildren'` `'wherelabel'` `'whererow'` `'list'` `'label'` `'images'` or `'handle'`.

The second argument is a node ID or vector of node ids to query.

The optional third argument specifies the depth of children to query. 0 means return information about the node itself only. 1 means return information about the node and its immediate children, 2 means return information about the node, its children, and grandchildren, and so on. You can also specify ¯1 to indicate that information about all descendants (to any depth) should be returned.

The result is a vector or matrix (depending on attribute), with one item/row for each node. If the optional third argument is given, the result is a matrix with the first column giving node IDs, the second column giving relative depth, and remaining column(s) giving attribute values. The returned values are as follows:

#### Querying the state of the node(s)

Keywords: `'forceparent'` `'highlightbold'` `'highlightcut'` `'highlightdrop'` `'highlightselect'` `'expanded'` `'expandedonce'` `'haschildren'`

These each return a single boolean value for each node, indicating whether the specified attribute is true or false for each node.

#### Querying the labels associated with the node(s)

Keyword: `'label'`

This keyword returns a character vector for each node, containing the label.

#### Querying the images associated with the node(s)

Keyword: `'images'`

In this case a matrix is returned, with one row for each node. The matrix has four columns, containing the indices in the Tree object's `imagelist` of the non-selected image, selected image, overlay image, and user-state image. In each case, 0 is returned if there is no corresponding image associated with the node. (If the optional third argument was supplied, a 6-column matrix is returned. The first two columns are the node ID and depth, and the subsequent columns are the image indices).

#### Querying all the data used to set up the node(s)

Keyword: `'list'`

In this case a matrix is returned, with one row for each node. The matrix has three columns, containing values of the third, fourth and fifth columns of the `list` property corresponding to the node. These are the label, the image indices vector, and the state keywords. (If the optional third argument was supplied, a 5-column matrix is returned. The first two columns are the node ID and depth, and the subsequent columns are the above data).

#### Querying the position and size of the node(s)

Keywords: `'wherelabel'` or `'whererow'`

In these cases a matrix is returned, with one row for each node. The matrix has four columns, corresponding to the top, left, height and width of the rectangle occupied by the whole node (for `'whererow'`) or just its label (for `'wherelabel'`). The values are expressed in the current `scale` of the Tree object. Coordinates of all 0s are returned if the node is not visible because it is not expanded. Note that the coordinates may be negative or greater than the client area of the Tree control if the node is not currently scrolled into view. (If the optional third argument was supplied, a 6-column matrix is returned. The first two columns are the node ID and depth, and the subsequent columns are the top, left, height, width values).

#### Retrieving the internal handle of the node(s)

Keyword: `'handle'`

Under Windows, this keyword returns an integer value for each node, containing a handle of type `HTreeItem` which Windows uses to identify the node internally. It can be used for low-level programming. Under MacOS and Linux, this keyword returns 0 for each node.

Topic: APLX Help : System Classes : Methods : Getinfo

[ Previous | Next | Contents | Index ]