if I'm not mistaken it's not possible to have invisible nodes in a
TVirtualStringTree treeview, as there are no enabled, visible or other
properties to do so. Am I right about this?
If yes, how did I manage to have a non visible node?
Structure of my tree:
- One Node
- Another node
- Subnode 1
- Subnode 2
- ...
- Subnode 15
- Subnode 16 (which is not visible!)
- Yet another node
- Subnode 1 from yet another node
- Subnode 2 from yet another node
I can find Subnode 16 when I do a FirstNode/GetNextNode loop over the
whole tree and let me print out the text for the first column. I can
also inspect the node and see that he's got a previous sibling but no
next sibling for instance and the node height is 18.
So how did I do this?
if I'm not mistaken it's not possible to have invisible nodes in a TVirtualStringTree treeview, as there are no enabled, visible or other properties to do so. Am I right about this?
You are wrong, it is possible to have both invisible and disabled nodes. To switch visible state of the node use
vtree.IsVisible[Node] := boolean;
to enable / disable node use
vtree.IsDisabled[Node] := boolean;
You can also initialize node to disabled state in tree's OnInitNode
event with adding ivsDisabled
to InitialStates
parameter.
In Addition to ains answer, to recurse the tree you can use the following functions:
To recurse ALL nodes
Tree.GetFirst();
Tree.GetNext();
Tree.GetPrevious();
To recurse only VISIBLE nodes:
Tree.GetFirstVisible();
Tree.GetNextVisible();
Tree.GetPreviousVisible();