Blitz3D+ Command Reference

CreateTreeView ( x,y,width,height,group[,style] )

Parameters

x,y - position of the tree view's top-left corner within the group's client area

width,height - size of the tree view

group - window or gadget group that owns the tree view

style (optional) - 0 (default); other values are reserved

Description

Creates a tree view gadget for hierarchical lists, and returns its handle.

Requires Extended language mode.

The scene-hierarchy control: nested, expandable nodes, exactly what a level editor uses to show Scene, Camera, Lights and their children. Every tree starts with a single invisible root - get it with TreeViewRoot - and you grow the hierarchy from there with AddTreeViewNode and InsertTreeViewNode. Node handles are positive, type-checked IDs just like gadget handles.

When the user clicks a node, the tree posts a critical gadget-action event ($401, EventData 0) through the shared event queue; call SelectedTreeViewNode to find which node is now selected and TreeViewNodeText for its label. Select from code with SelectTreeViewNode, and open or fold branches with ExpandTreeViewNode and CollapseTreeViewNode.

Node text is UTF-8, and nodes can show icons from a strip assigned with SetGadgetIconStrip by passing an icon index when the node is created.

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

See also: TreeViewRoot, AddTreeViewNode, SelectedTreeViewNode, ExpandTreeViewNode, FreeTreeViewNode, SetGadgetIconStrip.

Index