TForm property that's an array (or collection) of TFrame descendants

有些话、适合烂在心里 提交于 2019-12-13 03:16:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!