But you should not need to use this in Delphi - this is old non OO TP type
code :)

Instead of creating a dynamic record with pointers, create a class instance
and store its reference in a TList or a derivative.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Stephen Bertram
> Sent: Thursday, 14 December 2000 16:46
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: AddObject and record structures
>
>
> I do this by creating the record structure with new first - eg
>
> procedure add(strlst : TStringList; txt : string; [items for record] ...)
> var
>    rec_ptr : ^TNodeRecord;
> begin
>    new(rec_ptr);
>    rec_ptr^.ntype      := typ;
>    rec_ptr^.level      := level;
>    rec_ptr^.actionable := actionable;
>    rec_ptr^.populated  := populated;
>    rec_ptr^.expandable := expandable;
>    rec_ptr^.filtered   := false;
>    rec_ptr^.filter     := '';
>    rec_ptr^.text       := text;
>    rec_ptr^.ref        := ref;
>    strlst.addobject(txt, recptr);
> end;

 procedure add(MyList : TMyList; txt : string; [items for record] ...)
 var
    AnInstance : TSomeClass;
 begin
   AnInstance := TSomeClass.Create;
    AnInstance.ntype      := typ;
    AnInstance.level      := level;
    AnInstance.actionable := actionable;
    AnInstance.populated  := populated;
    AnInstance.expandable := expandable;
    AnInstance.filtered   := false;
    AnInstance.filter     := '';
    AnInstance.text       := text;
    AnInstance.ref        := ref;
    MyList.AddObject(txt, AnInstance);
 end;

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to