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), or 1 to enable dragging nodes within this tree |
Description
|
Creates a tree view gadget for hierarchical lists, and returns its handle. 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. With style 1, starting a left-button drag selects the source node. Dropping onto another node posts a critical gadget-drop event ($403). EventSource is the tree, EventData is the dragged node handle, EventZ is the destination node handle, and EventX/EventY are the drop coordinates in logical pixels. The tree highlights the destination, expands branches after a short hover, and scrolls near its top and bottom edges. Your program decides how to update its data and rebuild the tree; the control does not move nodes automatically. Drops onto the dragged node or its descendants are ignored. Dropping outside a node, pressing Escape or the right mouse button, losing focus/capture, hiding/disabling the tree, or deleting a participating node cancels the drag without posting a drop event. Handles can become stale if your program rebuilds the tree before processing a queued event. 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. Requires Extended mode. See also: TreeViewRoot, AddTreeViewNode, SelectedTreeViewNode, ExpandTreeViewNode, FreeTreeViewNode, SetGadgetIconStrip. |
Index