Yeah, that would make sense, but the virtual tree only allocates as much memory as is required by the GetNodeDatasize method, and that chunk is inherently a record. Its a weirdness of the Virtual tree.
----- Original Message ----- From: "Neven MacEwan" <[EMAIL PROTECTED]> To: "Trevor Jones" <[EMAIL PROTECTED]>; "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]> Sent: Monday, June 14, 2004 6:56 PM Subject: Re: [DUG] Record inheritance > Trevor > > Why don't you use a TObject descendant and > point the VirtualTree node at that (rather than a record) > > Neven MacEwan (B.E. E&E) > Ph. 09 621 001 Mob. 0274 749062 > > > > 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 > > > > > > > > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi > > _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
