Delphi, VirtualStringTree - classes (objects) instead of records

Posted by michal on Stack Overflow See other posts from Stack Overflow or by michal
Published on 2010-02-18T12:14:49Z Indexed on 2010/04/21 4:13 UTC
Read the original article Hit count: 370

I need to use a class instead of record for VirtualStringTree node.

Should I declare it standard (but in this case - tricky) way like that:

PNode = ^TNode;
TNode = record
 obj: TMyObject;
end;
//..
var
 fNd: PNode;
begin
fNd:= vstTree.getNodeData(vstTree.AddChild(nil));
fNd.obj:= TMyObject.Create; 
//..

or should I use directly TMyObject? If so - how?! How about assigning (constructing) the object and freeing it?

Thanks in advance m.

© Stack Overflow or respective owner

Related posts about delphi

Related posts about delphi-7