Programmatically selects a specific node in a TreeView control.
Takes gizmoNode (Int) and parentTreeview (Int).
Returns 1.
BGI GUI
Parameters & Returns
Parameters
gizmoNodeInt
parentTreeviewInt
Returns
Int
Quick Summary
Programmatically selects a specific node in a TreeView control.
Takes gizmoNode (Int) and parentTreeview (Int).
Returns 1.
Technical Exegesis...
Programmatically selects a specific node in a TreeView control. Searches gizmoMap for parentTreeview ID to get TreeView HWND. Searches treeviewNodes vector for gizmoNode ID to find the node's HTREEITEM handle. If both found, sends TVM_SELECTITEM message with TVGN_CARET flag and hTargetNode. If selection succeeds, calls SetFocus on TreeView and returns 1. Returns 0 if selection failed or node not found. Returns -1 if TreeView not found.
This function selects a node and gives keyboard focus to the TreeView.
Programmatically selects a specific node in a TreeView control. Searches gizmoMap for parentTreeview ID to get TreeView HWND. Searches treeviewNodes vector for gizmoNode ID to find the node's HTREEITEM handle. If both found, sends TVM_SELECTITEM message with TVGN_CARET flag and hTargetNode. If selection succeeds, calls SetFocus on TreeView and returns 1. Returns 0 if selection failed or node not found. Returns -1 if TreeView not found.
This function selects a node and gives keyboard focus to the TreeView. TVM_SELECTITEM message with TVGN_CARET flag sets the selection (caret = keyboard focus/selection). SetFocus ensures TreeView receives keyboard input. Selected node becomes highlighted and fires selection-changed events. Use for programmatic navigation, restoring saved selections, or implementing find/search features. Returns 0 if node ID is invalid or selection message fails.