GetItemRect Function (TreeView)

Class

TreeView.

Action

Returns the size and position of an item relative to the treeview control.

Availability

This function is supported in scripts that use both the Classic Agent and the Open Agent.

Syntax

SizeRect = treeview.GetItemRect(Item[, bIconRect])
Variable Description
SizeRect The item’s rectangle. RECT.
Item The item to find. STRING or INTEGER.
bIconRect Optional: TRUE to return the size and position of the icon. Default returns the rectangle of the text. BOOLEAN.

Notes

By default, GetItemRect returns the rectangle for the text of the item. The rectangle returned includes the item’s X and Y position, relative to the treeview control, its width, and its height.

Optional: use bIconRect to have the return value specify the location and size of the item’s icon instead. If the item is currently scrolled out of view, the returned coordinates reflects this. For example, if item 1 is specified, and the top item currently visible is item 10, then the Y coordinate returned is a negative number.

Note: The optional parameter bIconRect is not useful when Item is a JavaJFCTreeView.

For information on specifying Item, see the TreeView class.

Example

RECT rect
MyDialog.MyTreeView.ExposeItem("/root/child/grandchild")
rect = MyDialog.MyTreeView.GetItemRect("/root/child/grandchild", TRUE)
MyDialog.CaptureBitmap(rect.xPos, rect.yPos, rect.xSize, rect.ySize)