Hello!
I have a TTree with a lot of nodes in it. How can I programatically make a certain node to be visible in the Tree? (Inside the visible area of the tree)
Best regards, Mikael
Make node visible in TTree
Re: Make node visible in TTree
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Make node visible in TTree
Sorry, I explained badly... In my TTree I have a tree structure displayed, like in Explorer. Now I want my TTree to scrool so that my current node becomes visible.
best regards, Mikael
best regards, Mikael
Re: Make node visible in TTree
Hi Mikael,
In the following example, we have a root node with a hundred childs.
If you want you can scroll down dragging the Tree with the right mouse button, or you can use the scrollbar for the same.
If you are looking for a function to force the scroll to a determined child by code, you can use View3DOptions.VertOffset:
In the following example, we have a root node with a hundred childs.
If you want you can scroll down dragging the Tree with the right mouse button, or you can use the scrollbar for the same.
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
TreeNodeShape1: TTreeNodeShape;
begin
TreeNodeShape1:=Tree1.AddRoot('Root');
TreeNodeShape1.Expanded:=true;
for i:=0 to 100 do
TreeNodeShape1.AddChild('Child ' + IntToStr(TreeNodeShape1.Children.Count+1));
end;
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
TreeNodeShape1: TTreeNodeShape;
begin
TreeNodeShape1:=Tree1.AddRoot('Root');
TreeNodeShape1.Expanded:=true;
for i:=0 to 100 do
TreeNodeShape1.AddChild('Child ' + IntToStr(TreeNodeShape1.Children.Count+1));
TreeNodeShape1.Children[49].Selected:=true;
Tree1.Draw;
Tree1.View3DOptions.VertOffset:=-TreeNodeShape1.Children[49].Y0;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |