数组属性,TList,TStringList或TCollection等(Delphi Win32) [英] Array Property, TList, TStringList, or TCollection, etc (Delphi Win32)

查看:156
本文介绍了数组属性,TList,TStringList或TCollection等(Delphi Win32)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发各种组件,并经常遇到需要具有一对多关系的属性,即组件到属性成员。组件通常是可视化组件,但不总是,有时需要在IDE中注册(即使用属性检查器),但并不总是。我发现自己不确定在设置这些属性时使用哪个路由 - 使用数组属性,一个TList,一个TStringList,一个TCollection或者其他的东西(也许是从其中一个继承的新类)。

I am developing various components, and regularly run into the need to have a property that has a "one-to-many" relationship, component-to-property-member. The components are often visual components, but not always, and sometimes need to be registered with the IDE (i.e. use the Property Inspector), but not always. I find myself unsure of which route to take when setting up these properties -- using an array property, a TList, a TStringList, a TCollection, or something else altogether (perhaps a new class that inherits from one of those).

在哪里/哪里使用什么最佳做法/指南?

What are the "best practices" / guidelines for which to use when / where?

推荐答案

如果它们是属性,则可以从TCollection下降,然后IDE和Object Inspector将通过TCollection属性编辑器自动为它们提供支持。

If they are properties, you can descend from TCollection, and then the IDE and Object Inspector will automatically provide support for them via the TCollection Property editor.

这篇关于数组属性,TList,TStringList或TCollection等(Delphi Win32)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆