VirtualStringTree how to free multiple nodes

I have a VirtualStringTree with X roots and X childnodes.

Every root has a special NodeData assigned. Every childnode has another NodeData assigned. How do I know OnFreeNode which is which? Cause I can't free the data without knowing which record is assigned to it. Any Ideas?


To determine a node level use the GetNodeLevel function. It returns the 0 based level index, where 0 means a root node, 1 is for a root's child, 2 is for a root's grandchild etc.

So, in OnFreeNode event you can use something like this:

procedure TForm1.VirtualTreeFreeNode(Sender: TBaseVirtualTree;
  Node: PVirtualNode);
begin
  case VirtualTree.GetNodeLevel(Node) of
    0: // free your root node data
    1: // free your root's child node data
  end;
end;
链接地址: http://www.djcxy.com/p/35066.html

上一篇: 如何选择VirtualStringTree中的所有根节点或所有子节点?

下一篇: VirtualStringTree如何释放多个节点