Treeview will highlight node @runtime

I am trying to figure out how to select a node in a tree structure at runtime, I know the node index, but I don’t see how I can select it in the code. Also how can I collapse any other open node and expand the selected one in the code

thanks

+4
source share
1 answer

1) Collapse TreeView using the FullCollapse method

TreeView1.FullCollapse; 

2) To select (highlight) a Node assign the Selected property

 TreeView1.Selected:=TreeView1.Items[NodeIndex]; 

3) Expand the selected Node using the Expand method

 TreeView1.Items[NodeIndex].Expand(True); 
+7
source

Source: https://habr.com/ru/post/1395808/


All Articles