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;

HTH

Stephen
  

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, 15 December 2000 05:17
To: Multiple recipients of list delphi
Subject: [DUG]: AddObject and record structures


Hi all.

I have been doing some stuff with ADDObject in stringlists and passing ecord
structures thru.

I found that I cold go...mystrings.addobject('hello',myrecord) perfectrly
fine IF the record structrue only had one entry...
i.e. TMyRecord = record
      iPs :Integer;

BUT If I add an oher entry (1 or more of them)
i.e. TMyRecord = record
      iPs :Integer;
      ime :integer;
etc.

It will no longer compile with an incompatable type error on the addobject
line.

Whay IS this....I am not sure whay this happens...can anyone offer an
explination...and a solution?

Cheer, Jeremy Coulter  


 
 
 

---------------------------------------------------------------------------
    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"
---------------------------------------------------------------------------
    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