Re: [fpc-pascal]TCollection question

2003-07-07 Thread Matt Emson
James, Think of my code as a design pattern for a list, or possibly a template. You could replace the class name you are storing everywhere in the code and would then have a completely different List class. A bit like a C++ template, except you have to define all the code each time. A question

Re: [fpc-pascal]TCollection question

2003-07-06 Thread James Mills
On Sun, Jul 06, 2003 at 04:25:15PM +0200, Marco van de Voort wrote: Is there an example of using TCollection or something (without having to write the code myself) that manages a collection of FPC style classes (objects) ? I'd like to see one, code I have written to handle a dynamic

Re: [fpc-pascal]TCollection question

2003-07-06 Thread Marco van de Voort
IIRC, TCollection only stores TCollectionItem derived classes. TList is closer to what you want probably. Is there an example other than list.pp in the fcl source ? Also just for the record of knowing... I have attached datanicks.pas which hold a dynamic array of TNick ... Is this

Re: [fpc-pascal]TCollection question

2003-07-06 Thread Marco van de Voort
On Sun, Jul 06, 2003 at 05:11:17PM +0200, Marco van de Voort wrote: which hold a dynamic array of TNick ... Is this what TList already does (if so I'm wasting my time writing my own code...) ? Pretty much yes, but in a class wrapper. You can add and remove items, iterate through them

Re: [fpc-pascal]TCollection question

2003-07-06 Thread James Mills
On Sun, Jul 06, 2003 at 05:31:59PM +0200, Marco van de Voort wrote: On Sun, Jul 06, 2003 at 05:11:17PM +0200, Marco van de Voort wrote: which hold a dynamic array of TNick ... Is this what TList already does (if so I'm wasting my time writing my own code...) ? Pretty much yes, but

Re: [fpc-pascal]TCollection question

2003-07-06 Thread James Mills
Actually Michael, Could you possibly spare 5 mins and give a really simple example of a TList descandent ? I'm a tad confused here, (too slowly getting anywhere)... Thank you :) cheers James ___ fpc-pascal maillist - [EMAIL PROTECTED]

Re: [fpc-pascal]TCollection question

2003-07-06 Thread Matt and Lisa Emson
Message - From: James Mills [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 06, 2003 4:56 PM Subject: Re: [fpc-pascal]TCollection question Actually Michael, Could you possibly spare 5 mins and give a really simple example of a TList descandent ? I'm a tad confused here, (too slowly

Re: [fpc-pascal]TCollection question

2003-07-06 Thread James Mills
FList.Delete(AIndex); end; function Count: integer; begin Result := FList.Count; end; - Original Message - From: James Mills [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 06, 2003 4:56 PM Subject: Re: [fpc-pascal]TCollection question Actually Michael