InsertTreeViewNode ( index,text$,parent_node[,icon] )

Parameters

index - position among the parent's children, starting at 0; values past the end append

text$ - text for the new node

parent_node - node to insert under; use TreeViewRoot for a top-level node

icon (optional) - icon index from the strip assigned with SetGadgetIconStrip; -1 for no icon (default)

Description

Inserts a new node at a chosen position under a tree view node and returns its handle.

The positional sibling of AddTreeViewNode, which always appends. Use this when order matters and the natural spot is not the end - keeping a hierarchy pane alphabetical, or placing a duplicated entity's node directly after its original. Index 0 puts the node first; existing siblings from that position shift down; an index at or past the child count simply appends.

The returned handle is a positive, type-checked ID you keep to select, expand, rename or free the node later. Node text is UTF-8.

Inserting is silent - no events are posted - and the new node starts unselected, under whatever expanded/collapsed state its parent already has.

The world editor shell sample shows the hierarchy building this fits into.


See also: AddTreeViewNode, TreeViewRoot, CountTreeViewNodes, ModifyTreeViewNode, FreeTreeViewNode.

Index