Avatar of Mike Littlewood
Mike Littlewood
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Another general question about Vitrual String Tree

Expect a few more questions on this subject as its the first time I've really had a go at using this component.

I just wanted to clear up a bit of confusion I am having about using my own object at a node for this tree component.

From what I can gather this component tends to use a record object at the node.
What I am trying to do is keep a reference to my loaded object at the node.

Now I have this
   PLinkData = ^TLinkData;
   TLinkData = record
      curObject: TObject;

In my method that builds the nodes I have some var parameters

   newObject: TObject;
   newNode: PVirtualNode;
   newData: PLinkData;

In my method to build the nodes there is a method to add child nodes
               newNode := virtualStringTree1.addChild( pNode, newObject);
               newData := virtualStringTree1.getNodeData( newNode);
               newData.curObject := newObject;

Notice though that I am adding my object in the addChild method as well as putting a pointer in my record object. Here though I am getting a bit confused as you can probably tell.
I would have expected the getNodeData method to return the newObject in addChild( pNode, newObject)
Obviously though it is returning this generic record object and I am having to reference my own pointer.

What am I missing here?

Avatar of undefined
Last Comment
Mike Littlewood

8/22/2022 - Mon