AdvTreeView - Making selected node visible

Hi Pieter, another query re this component.

If I use SelectNode() to select a node that is not currently visible (ie scrolled out of view) is there a way I can scroll the selected node into view?

Thank you.

Hi, 


Yes, you can with the ScrollToNode method.

Kind Regards, 
Pieter

Thank you, just what I was looking for!

2 more questions if I may:

Firstly, Is there a method to make a node visible (ie ensure it's parent/grandparent/etc are all expanded), or will I need to do something like:

  while Node.GetParent<>NIL do
  begin
    Node:=Node.GetParent;
    Node.Expand;
  end;

Secondly, when I use AutoSizeColumn, which nodes are processed? Is it all visible nodes, immaterial of whether they are scrolled into view, or just the nodes that are currently in view.
What i need to know is, if I call ExpandAllNodes and then AutoSizeColumn will the column be the max width of all the nodes in the tree?



Hi, 


There is no additional method to make sure all previous nodes (parents) are expanded.
You will need to manually step through the nodes to expand them as you already demonstrated in the code snippet.

The autosizing is applied to the visible nodes only. Even if a node is already expanded but "out of sight", the autosizing will not take those into account. If you want to autosize when scrolling you could use the OnVScroll event. Additionally you could also apply autosizing when a node is expanded/collapsed.

Kind Regards, 
Pieter