Hi Bevan

I see, it is C.
I have managed to get it to work! if I make it a static array rather than dynamic (as
in the C example).
eg. categories : array[0..500] of TStringList
I would rather have it dynamic because the number of elements is unknown.  Is there
no easy way around it?

Ross.


Bevan Edwards wrote:

> Ross, that's C/C++ code, not Delphi.
>
> I'm not quite sure of the Delphi equivalent, but it's basically creating
> a type called MyLists which is a pointer to a TStringList.
>
> the MyLists* MyStrings = new Test[10] basically allocates memory to hold
> an array of 10 TStringList pointers.
>
> the next part, goes through each element of the array and creates a new
> TStringList for each entry of the array.
>
> I hope that helps in some way.
>
> Regards,
>
> Bevan
>
> Ross Levis wrote:
> >
> > Thanks Mark, but I don't want anything complicated.  I'm very new to Delphi &
> > I'm probably going about it the wrong way.  Though I found the following code
> > on the net which is suppose to provide an array of tstringlist but I don't
> > understand the syntax.  I think it's from an old version of Delphi.  Is someone
> > able to give me the Delphi 5 equivilent syntax?
> >
> > typedef TStringList * MyLists;
> > MyLists * MyStrings = new Test[10];
> > for (int i =0; i <10; i++)
> >       MyStrings[i] = new TStringList;
> >
> > Ross.
> >
> > Mark Derricutt wrote:
> >
> > > SOunds like you could do with my TStringCollection comp, email me in the
> > > morning and I'll forward the code when I get to work in the morning.
> > >
> > > --On Thursday, July 05, 2001 21:55:54 +1200 Ross Levis
> > > <[EMAIL PROTECTED]> wrote:
> > >
> > > > I was hoping the following would work but it appears not.  It compiles
> > > > OK but produces memory errors at runtime.  Why doesn't the compiler
> > > > complain if TSringList can't be used in an array?
> > > >
> > >
> > > ---------------------------------------------------------------------------
> > >     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"
>
> --
> Bevan Edwards                           mailto:[EMAIL PROTECTED]
> Achieve Software Limited                http://www.achieve.co.nz
> Phone:  (64-9) 444-4210                 ICQ: 732011
> Fax:    (64-9) 444-4201
> Mobile: (64-21) 979-603
> ---------------------------------------------------------------------------
>     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