TreeView Xojo plugin

TreeViewExtensions.IndexFromNode Method

Gets a screen index from a given node.

IndexFromNode(
   node as TreeViewNode) as Integer

Parameters

node
The node to find the index for.

Returns

Integer
The index of the node if found, -1 if it was not found. (Note that a node only has screen index if its within expanded scope)

Remarks

This function needs to loop the Nodes, using it should be avoided for performance reasons. But there are valid cases where using a function like this cannot be avoided.

Since this function extends the TreeView control then it can be called like:

myIndex = TreeView1.IndexFromNode(myNode)


(The TreeViewExtensions.rbo module has to be in your project).

Note
There is another variation of this function which can give better performance if the index of the parent node or a node above your node is known.

See Also

TreeViewExtensions Module