> -----Original Message-----
> VCL - TCollection/TCollectionItem
>
> Be able to change the class of the collection items created by
> "TCollection.Add "
> (This can be done currently using Pointers - but of course this is not
> guaranteed to work in the future)
>
> Basically would like to be able to set the TCollectionItem
> Class, but the
> class must be a derivative/descendant of the original class
> used in the
> collection constructor.
>
> e.g.  using the THeaderControl as an example
>
> TMyHeaderItems = Class( THeaderSection );
> THeaderControl.Sections.ItemClass := TMyHeaderItems;

And for this to also work when the TCollection class is serialised.  This is
not difficult to do, as long as the class name is stored in the stream.
Also support for this in the collection property editor.

Change the way menus store menuitems to use collections and to use the
above.

My pet ask for TCollection is to have a method to implement keys into the
items, ie a TCollectionKeys / TCollectionKey class hierarchy.  For example,
I would like to have:


type
  TSomeKey = class (TCollectionKey)
  protected
    function Compare (item1, item2: TCollectionItem): Integer; Override;
  end;

...

collection := TCollection.Create ...
collection.AddKey ('key1', TSomeKey);

someclass := collection.Add;
someclass.Key := 'abc';

otherclass := collection.keys[key1, 'abc'];


Or perhaps some kind of hash table implementation.


Regards,
Dennis.

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

Reply via email to