Inserts a new child node before an existing child node in a TreeView.
Takes parentNode (Int), childNode (Int), text (String), and parentTreeview (Int).
Returns 1 on success, 0 on failure or if TreeView not found.
BGI GUI
Parameters & Returns
Parameters
parentNodeInt
childNodeInt
textString
parentTreeviewInt
Returns
Int
Quick Summary
Inserts a new child node before an existing child node in a TreeView.
Takes parentNode (Int), childNode (Int), text (String), and parentTreeview (Int).
Returns 1 on success, 0 on failure or if TreeView not found.
Technical Exegesis...
Inserts a new child node before an existing child node in a TreeView. Searches gizmoMap for parentTreeview ID to get TreeView HWND. Searches treeviewNodes vector for parentNode and childNode IDs to get their HTREEITEM handles. Increments global treeviewIDCount for new node ID. Calls InsertTreeViewItem helper function with parentHWND, hParentNode, hChildNode (insert before this), text, and treeviewIDCount.
Inserts a new child node before an existing child node in a TreeView. Searches gizmoMap for parentTreeview ID to get TreeView HWND. Searches treeviewNodes vector for parentNode and childNode IDs to get their HTREEITEM handles. Increments global treeviewIDCount for new node ID. Calls InsertTreeViewItem helper function with parentHWND, hParentNode, hChildNode (insert before this), text, and treeviewIDCount. If successful, removes old childNode from treeviewNodes vector, creates new CTreeViewNode structure, adds to treeviewNodes, and deletes old childNode HTREEITEM with DeleteTreeViewItem. Returns 1 on success, 0 on failure or if TreeView not found.
This function inserts a new node between a parent and an existing child, effectively replacing the child's position. The new node takes the childNode's position in the sibling order. The old childNode is deleted from the tree and the treeviewNodes tracking vector. InsertTreeViewItem is a helper function that handles the Windows TreeView insertion logic. Use for reordering tree items, replacing nodes, or inserting nodes at specific positions. Returns 0 if parent or child nodes don't exist.