In reply to Aaron Scott-Boddendijk
------------
My GenericCollection (Items are not restricted by heritage) I created
internally
here has 2 levels to it

TJAbstractBaseList
    Implements all functionality of being a list without declaring a storage
mechanism. It
    declares things like Delete(Index), Exchange(Index)...

TJAbstractObjectList
    Implements all functionality of carrying a list of records (in a dynamic
array) of Objects
    There is a GetItem(Index :Integer):Tobject and it's Set equivelent but
no Items property
    Does include Add(O :TObject);
    Also implements an Accepts(O :TObject):Boolean which controlls allowing
duplicates,
    and restricts which classes can be added (disallowing Nil etc)

These are implemented in LIB_Lists.

an example of use is a TPeopleList object which adds the Items[Index
:Integer]:TPersonItem
property and overrides Accepts to restrict adding anything except
TPersonItem instances.
TPeopleList and TPersonItem are implemented in the same unit.

Can this mechanism aid you at all?
--------

I do something along the same lines, I have even added object saving and
loading behaviour to it.

Actually thinking about this it probably makes more sense to put them in the
same unit.  I think that when I spent lots of time on the design of the app
that I should have spent more time on its unit structure than I did. (or
didn't as I am begining to realise).

Now is probably an extremely good time to rethink it and shuffle all my
classes about before I proceed further. :-)


Thankyou all for your input.

Nahum
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to