Deletes the currently selected node and all its children from a TreeView.
Takes parentTreeview (Int).
Returns 1 on success, 0 if no selection or TreeView not found.
BGI GUI
Parameters & Returns
Parameters
parentTreeviewInt
Returns
Int
Quick Summary
Deletes the currently selected node and all its children from a TreeView.
Takes parentTreeview (Int).
Returns 1 on success, 0 if no selection or TreeView not found.
Technical Exegesis...
Deletes the currently selected node and all its children from a TreeView. Searches gizmoMap for parentTreeview ID to get TreeView HWND. Gets currently selected node with TreeView_GetSelection macro. Creates TVITEM with mask=TVIF_PARAM to retrieve node's lParam (node ID). Calls GetAllChildNodes helper function to recursively get all child HTREEITEMs. Iterates through child nodes: for each child, gets TVITEM.lParam (child ID) and searches treeviewNodes vector to erase matching entries.
Deletes the currently selected node and all its children from a TreeView. Searches gizmoMap for parentTreeview ID to get TreeView HWND. Gets currently selected node with TreeView_GetSelection macro. Creates TVITEM with mask=TVIF_PARAM to retrieve node's lParam (node ID). Calls GetAllChildNodes helper function to recursively get all child HTREEITEMs. Iterates through child nodes: for each child, gets TVITEM.lParam (child ID) and searches treeviewNodes vector to erase matching entries. Also erases the selected node itself from treeviewNodes. Calls DeleteTreeViewItem helper to remove selected node from TreeView (also removes all children). Returns 1 on success, 0 if no selection or TreeView not found.
This function performs recursive deletion - deleting a parent automatically deletes all descendants. GetAllChildNodes is a helper that traverses the tree to find all nested children. The function cleans up both the Windows TreeView control (via DeleteTreeViewItem) and the tracking vector (treeviewNodes). TVITEM.lParam stores the node ID used to match treeviewNodes entries. Use for removing tree branches, cleaning up hierarchies, or implementing delete operations. Handles both leaf nodes (no children) and parent nodes (with children).