Hi, Is it possible to hide the root node, and all branch nodes of that root?
Plus, when hidden, the tree closes up as though the hidden root node was not present.
As it is now, I can hide individual nodes but their empty space is still present.
Thanx
Hiding root nodes
Hi,
TeeTree was developed not only as a Tree substitute, therefor it doesn't always behaves as a Tree would.
To make all child nodes invisible, you can recursively iterate all childs by yourself, e.g.:
In order to have another behavior of the X/YPosition of the nodes, you can make a ChildManager descendant which does take the visibility of a node into account. Have a look at the default ChildManager (TTreeExplorerAlignChild) and particulary in the X and YPosition methods. If you then change the default ChildManager to the new developed, the tree will behave as you would like.
Regards,
Tom
TeeTree was developed not only as a Tree substitute, therefor it doesn't always behaves as a Tree would.
To make all child nodes invisible, you can recursively iterate all childs by yourself, e.g.:
Code: Select all
procedure TForm2.HideClick(Sender: TObject);
procedure Hide(Node: TTreeNodeShape; Recursive: Boolean);
var t : Integer;
begin
Node.Visible :=False;
if Recursive then
for t:=0 to Node.Children.Count-1 do Hide(Node.Children[t], True);
end;
begin
Hide(TreeNodeShape1, True);
end;
In order to have another behavior of the X/YPosition of the nodes, you can make a ChildManager descendant which does take the visibility of a node into account. Have a look at the default ChildManager (TTreeExplorerAlignChild) and particulary in the X and YPosition methods. If you then change the default ChildManager to the new developed, the tree will behave as you would like.
Regards,
Tom