How to make a TTreeView node display when I select it?

If I have a TTreeView and I call something like this:

myTreeView.Select(nodeIWantSelected);

it is selected, but unless the node is inside the part of the tree that is currently visible, I can’t see it and I need to drag the scroll bar until I find its position. How to make TTreeView scroll to node when selecting it?

+3
source share
2 answers

Use nodeIWantSelected.MakeVisible

+4
source

I cannot check it right now, but one of them may cause the desired effect:

myTreeView.Select(nodeIWantSelected);
myTreeView.Selected.MakeVisible;
// or
myTreeView.Selected.Focused := true;
+1
source

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


All Articles