[Lazarus] Inserting many components on form

Max Vlasov max.vlasov at gmail.com
Tue Jul 12 13:41:27 CEST 2011


On Tue, Jul 12, 2011 at 2:53 PM, Fabio Luis Girardi
<fluisgirardi at gmail.com> wrote:
> I found another way to do this: extend the TCollection and write a new
> procedure Add to allow choose what's the item class the user wants
> create and make a Property editor for this new Collection class, that
> will call this new Add method (yes, can be more easy if the Add
> procedure of the TCollection as set as virtual, but...).

Fabio, as long as I remember, currently there's no typeinfo stored for
particualar collection item (you can look at any dfm or lfm containing
collections), so you will probably lose the type difference when you
collection is loaded. If it's hard to solve, I remember I experimented
with persistents (like TFont) being different types for the same owner
component type so you can use a property in the common collection item
that defines the type and this property recreate a persistent being
other property of the same item.

Max




More information about the Lazarus mailing list