TreeView Xojo plugin

TreeView.BeforeNodeExpanding Event

This event is fired when a node is about to expand.

BeforeNodeExpanding(
   node as TreeViewNode,
   nodeIndex as Integer)

Parameters

node
The node that is about to expand.
nodeIndex
The screen index of the node that is about to expand.

Remarks

Do not manipulate any nodes that are not children of the expanding node from within this event.

In the example bellow we demonstrate how to add nodes at the time of expanding. This technique can be useful in many cases, such as when browsing directories for example.

Dim tmp as TreeViewNode

// Note that we don't lock the drawing and we should not do so,
// the BeforeNodeCollapsing and BeforeNodeExpanded are in a protected
// drawing scope.

// Here we add some nodes
tmp = new TreeViewNode("Test 1",Folder)
tmp.HasExpander = true

node.AppendNode(tmp)

tmp = new TreeViewNode("Test 2",Folder)
tmp.HasExpander = true

node.AppendNode(tmp)

tmp = new TreeViewNode("Test 3",Folder)
tmp.HasExpander = true

node.AppendNode(tmp)


See also the Dynamic load example project that comes with the TreeView.

See Also

TreeView Control