Until then my Virtual String Tree is like the image below:
Iwouldliketocreateatreeastheexamplebelow,butthevaluesIwilldefine:
link
Until then my Virtual String Tree is like the image below:
Iwouldliketocreateatreeastheexamplebelow,butthevaluesIwilldefine:
link
To add a parent node declare a variable of type PVirtualNode
:
pai: PVirtualNode;
Give a command to start editing the grid before starting to insert the nodes:
vstGrid.BeginUpdate;
Add the parent node this way:
pai := vstGrid.AddChild(nil, ["Conteúdo do nó"]);
To add the children pass the parent in the first parameter:
vstGrid.AddChild(pai, ["Conteúdo do nó"]);
To create this in the opening of the form, make a loop in OnShow
using the commands mentioned above. This will vary depending on how you are bringing this information.
Once you have finished inserting the nodes, give the command to finish editing the grid:
vstGrid.EndUpdate;
If you want to bring the expanded nodes use the command:
vstGrid.FullExpand;