Blitz3D+ Command Reference

AddTreeViewNode ( text$,parent_node[,icon] )

Parameters

text$ - label of the new node

parent_node - node to add the new node under; use TreeViewRoot for a top-level node

icon (optional) - zero-based index into the tree view's icon strip; -1 for no icon (default)

Description

Adds a new node under a tree view node and returns its handle.

Requires Extended language mode.

Appends the new node as the last child of parent_node. For a top-level node, pass the invisible root you get from TreeViewRoot. The returned handle is a positive, type-checked ID you keep to select, expand, rename or free the node later.

This is how you build the classic editor hierarchy: a Scene node under the root, then cameras, lights and objects as children - exactly the pattern the samples use. Node text is UTF-8, and an icon from the strip assigned with SetGadgetIconStrip can be shown by passing its index.

To place a node at a specific position among its siblings instead of at the end, use InsertTreeViewNode. When the user clicks a node, the tree posts a gadget-action event ($401); read SelectedTreeViewNode to find out which node it was.

See it working in the tree and text area sample and throughout the world editor shell sample.

See also: InsertTreeViewNode, TreeViewRoot, CountTreeViewNodes, SelectTreeViewNode, ModifyTreeViewNode, FreeTreeViewNode.

Index