Creates and attaches a root node to a TreeView control.
Takes text (String) and parentTreeview (Int).
Returns the new node ID (treeviewIDCount).
BGI GUI
Parameters & Returns
Parameters
textString
parentTreeviewInt
Returns
Int
Quick Summary
Creates and attaches a root node to a TreeView control.
Takes text (String) and parentTreeview (Int).
Returns the new node ID (treeviewIDCount).
Technical Exegesis...
Creates and attaches a root node to a TreeView control. Searches gizmoMap for the parentTreeview ID to get the TreeView HWND. Increments global treeviewIDCount for unique node ID. Creates TVINSERTSTRUCT with hParent=TVI_ROOT (root level), hInsertAfter=TVI_FIRST (insert at top), mask=TVIF_TEXT|TVIF_PARAM, pszText=text, lParam=treeviewIDCount. Sends TVM_INSERTITEM message to create the node. Creates CTreeViewNode structure with id, hTreeViewNode handle, parentHWND, parentWinID, and text.
Creates and attaches a root node to a TreeView control. Searches gizmoMap for the parentTreeview ID to get the TreeView HWND. Increments global treeviewIDCount for unique node ID. Creates TVINSERTSTRUCT with hParent=TVI_ROOT (root level), hInsertAfter=TVI_FIRST (insert at top), mask=TVIF_TEXT|TVIF_PARAM, pszText=text, lParam=treeviewIDCount. Sends TVM_INSERTITEM message to create the node. Creates CTreeViewNode structure with id, hTreeViewNode handle, parentHWND, parentWinID, and text. Adds to global treeviewNodes vector. Returns the new node ID (treeviewIDCount). Returns 0 if TreeView not found.
This function creates a top-level node in the TreeView hierarchy. Root nodes appear at the tree's base (not nested under any parent). TVI_FIRST means new root nodes insert at the top of existing roots. Each node gets unique ID via auto-incremented treeviewIDCount. The node ID (returned value) is used for subsequent operations like adding children, selecting, or modifying. Node tracking: HTREEITEM handle stored in treeviewNodes vector for lookup. Use for building tree structure, creating main categories, or initializing TreeView content.