[fpc-pascal] list classes or arrays in FPC
Graeme Geldenhuys
graemeg.lists at gmail.com
Tue Oct 2 08:29:33 CEST 2007
On 01/10/2007, Joao Morais <post at joaomorais.com.br> wrote:
> > I'm busy implementing a Objects[ARow, ACol] property for fpGUI's
> > StringGrid component and would like to read up on what efficient list
> > classes or arrays I could possibly use. I'll only be storing Pointers
> > and the StringGrid will *not* be maintaining the lifespan of the
> > Objects being stored. Only their pointers will be stored, so I guess
> > it doesn't need to be a complex list class or pointer array.
>
> You could use variant arrays or two dynamic arrays, but I personally
> prefer classes. This approach could be reached using a TObjectList
> instance to hold TObjectList objects, the getter should have something
> like this:
I don't like variants (I personally think they are a hack) and wasn't
to keen on arrays either - I also prefer classes. In the end it was
really easy and didn't need to add any extra classes or have to add
extra code to maintain the size on the container. I simply hooked into
the TStringList that stores the Cell text and used it's Object
property.
Thanks for the reply...
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the fpc-pascal
mailing list