if the array is not a field of an object then you must call initialize or finalize as per the delphi help before and after use. ie public to a unit?
-----Original Message-----
From: Jason Coley [mailto:[EMAIL PROTECTED]]
Sent: Friday, 7 February 2003 8:55 a.m.
To: Multiple recipients of list delphi
Subject: RE: Re: [DUG]: Dynamic arrays

I have a public delaration for the record type

 

Var

            MyRec: TRec;

 

 

 

When I fill the frame and image arrays I use

 

            SetLength(MyRec.Frames, Length(MyRec.Frames) + 1);

            SetLength(MyRec.Images, Length(MyRec.Images) + 1);

 

When I am finished I use

           

            SetLength(MyRec.Frames, 0);

            SetLength(MyRec.Images, 0);

 

Just normal stuff I think?

 

Regards

 

Jason Coley

Manawatu Software Solutions

email: [EMAIL PROTECTED]

web: http://www.software-solutions.co.nz

 

 

 

-----Original Message-----
From: Paul Mckenzie [mailto:[EMAIL PROTECTED]]
Sent:
Friday, 7 February 2003 8:32 a.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Dynamic arrays

 

How are you declaring and allocating ?

 

Regards
Paul McKenzie
Analyst Programmer
SMSS ltd.
 

----- Original Message -----

From: Jason Coley

Sent: Wednesday, February 05, 2003 4:38 PM

Subject: RE: [DUG]: Dynamic arrays

 

I should mention I am using Delphi 6 update 2

 

-----Original Message-----
From: Jason Coley
Sent: Wednesday, 5 February 2003 4:13 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Dynamic arrays

 

Hi there,

 

I have a record structure say

 

 

TFrames = record

            Desc:                shortstring;

            Side, top, width, height:  Integer;

            Use:                 Boolean;

End;

 

TImages = record

            Path:                shortstring;

            Side, top, width, height:  Integer;

            LockAspect:      Boolean;

            Use:                 Boolean;

End;

 

Trec = record

            Desc:                shortstring;

            I:                      Integer;

            Frames:            array of TFrame;

            Images:             array of TImages;

End;

 

Now when I resize the frames or images I use

            SetLength(Frames, Length(Frames) + 1);

            SetLength(Images, Length(Images) + 1);

 

Now this seems to work fine, except, if I have frames and then add a frame, sometimes the images gets corrupted, like if I had 5 images [0..4] and do a resize to Frames sometimes a images[2] will be duplicated to position 2 and 3, really weird, anyone had any problems with dynamic arrays like this?

 

Jay

 

Reply via email to