Its easier if you define it as a class. The pointer can point to any structure - it doesnt has to be a record

Trevor Jones wrote:

I think I should be able to do this without asking for help, but sometimes
the old brain just gets stuck.

I'm using a virtual tree to display and edit some data.

Each node has some data associated with it, and I use a record and a pointer
to that record to get the data.

If you are used to using Virtual Trees, you will know what I mean.

I've subclassed the form, overridden then GetNodeDataSize method, but since
the Tree.GetNodeData method always refers to a pointer to a record, I'm a
little bit stumped on how to add some extra fields to that record.

e.g.
 TOriginalNodeData = record
   id : integer;
  value : double;
 end;
 pOriginalNodeData = ^TOriginalNodeData;

Then with my subclass, the node data looks like this:

 TNewNodeData = record
   id : integer;
   value : double;
   valueInherited : boolean;
 end;

But this means that I have to re-declare all of the old fields in my new
record, and if the original record changes, things are going to go BANG.

I can declare

 TNewNodeData = record
   OldStuff : TOriginalNodeData;
   valueInherited : boolean;
 end;

and this works, but means I have to dereference OldStuff all of the time.

I'm sure that variant records should allow me to do what I want, but I'm
really stuck on how to declare it.

Any ideas?

Trevor





_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to