问题描述
我正在再次探索,从与以前稍有不同的角度来看:
I am exploring this subject again, from a slightly different angle than before:
我有TForm后代,该后代在其他几个组件中用作对话框,我想添加为属性TFrame后代的数组。
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.
我应该使用哪种多项目属性方法? (数组,TList,TObjectList,TCollection,TOwnedCollection等)。
What multi-item property approach should I use for this? (Array, TList, TObjectList, TCollection, TOwnedCollection, etc).
(从概念上讲,我也想知道为什么)
(I'd also love to know, conceptually, "why")
推荐答案
最简单的方法是基于TCollection。
The easiest is to base this on a TCollection.
在TFrame周围编写一个TCollectionItem后代包装。
Write a TCollectionItem descendant wrapper around your TFrame.
确保在其他人释放TFrame实例时,您的TCollectionItem得到通知!
Make sure that when the TFrame instance is freed by someone else, that your TCollectionItem gets notified!
使用和。
-jeroen
这篇关于TForm属性是TFrame后代的数组(或集合)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!