问题
I am exploring this subject again, from a slightly different angle than before:
I have TForm descendant which is used in a couple of other components as a dialog, that I'd like to add as a property an array of counted TFrame descendants.
What multi-item property approach should I use for this? (Array, TList, TObjectList, TCollection, TOwnedCollection, etc).
(I'd also love to know, conceptually, "why")
回答1:
The easiest is to base this on a TCollection.
Write a TCollectionItem descendant wrapper around your TFrame.
Make sure that when the TFrame instance is freed by someone else, that your TCollectionItem gets notified!
Use a construction like mentioned here and here for that.
--jeroen
来源:https://stackoverflow.com/questions/1447365/tform-property-thats-an-array-or-collection-of-tframe-descendants