有关于DELPHI的TCOLLECTION及TCOLLECTIONITEM类的使用??

morphia morphia 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
下面是一个完整的控件单元的代码,可以安装至DELPHI中。
但是!有一个很重要的问题出现了,在Test控件中的TTestCollection
属性可以点开,但是在TTestCollectionItem对象中的TTestSubCollection
属性却点不开了,难道TCollection不可以套用吗?还是我的类写得不正确?

能够解决这些问题的人快快回答我吧,我先谢谢了。 (分数可以再加,谢谢)

unit Test;

interface

uses
Classes;

type
TTestSubCollectionItem = class(TCollectionItem)
private
FProp004: Integer;
FProp003: string;
procedure SetProp003(const Value: string);
procedure SetProp004(const Value: Integer);
published
property Prop003: string read FProp003 write SetProp003;
property Prop004: Integer read FProp004 write SetProp004;
end;

TTestSubCollection = class(TCollection)

end;

TTestCollectionItem = class(TCollectionItem)
private
FProp02: Integer;
FProp01: string;
FSubCollection: TTestSubCollection;
procedure SetProp01(const Value: string);
procedure SetProp02(const Value: Integer);
procedure SetSubCollection(const Value: TTestSubCollection);
public
constructor Create(Collection: TCollection); override;
published
property Prop01: string read FProp01 write SetProp01;
property Prop02: Integer read FProp02 write SetProp02;
property SubCollection: TTestSubCollection read FSubCollection write SetSubCollection;
end;

TTestCollection = class(TCollection)

end;

TTest = class(TComponent)
private
FTestCollection: TTestCollection;
procedure SetTestCollection(const Value: TTestCollection);
public
constructor Create(AOwner: TComponent); override;
published
property TestCollection: TTestCollection read FTestCollection write SetTestCollection;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Test', [TTest]);
end;

{ TTestCollectionItem }

constructor TTestCollectionItem.Create(Collection: TCollection);
begin
inherited Create(Collection);
FSubCollection := TTestSubCollection.Create(TTestSubCollectionItem);
end;

procedure TTestCollectionItem.SetProp01(const Value: string);
begin
FProp01 := Value;
end;

procedure TTestCollectionItem.SetProp02(const Value: Integer);
begin
FProp02 := Value;
end;

procedure TTestCollectionItem.SetSubCollection(
const Value: TTestSubCollection);
begin
FSubCollection.Assign(Value);
end;

{ TTest }

constructor TTest.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FTestCollection := TTestCollection.Create(TTestCollectionItem);
end;

procedure TTest.SetTestCollection(const Value: TTestCollection);
begin
FTestCollection.Assign(Value);
end;

{ TTestSubCollectionItem }

procedure TTestSubCollectionItem.SetProp003(const Value: string);
begin
FProp003 := Value;
end;

procedure TTestSubCollectionItem.SetProp004(const Value: Integer);
begin
FProp004 := Value;
end;

end.
...全文

相关推荐

2026安卓开发从零实战指南:环境搭建、核心基础与避坑干货(适配新版Android_Studio).pdf

2026安卓开发从零实战指南:环境搭建、核心基础与避坑干货(适配新版Android_Studio).pdf

彼岸交流群

如何实现科研成果转化率的有效提升与技术市场精准对接?.docx

如何实现科研成果转化率的有效提升与技术市场精准对接?

BIZKEEN

基于PID控制的ABS汽车防抱死制动系统、车轮滑移率+最优滑移率Carsim和Simulink联合仿真(带参考文献)

内容概要:本文档系统研究了基于PID控制的ABS汽车防抱死制动系统,聚焦于车轮滑移率与最优滑移率的动态控制问题,采用Carsim与Simulink联合仿真平台构建高精度车辆动力学模型与控制系统。研究详细阐述了ABS的工作机理,通过设计PID控制器实时调节制动压力,确保车轮滑移率稳定在最优区间,从而最大化轮胎与路面间的摩擦力,提升制动效能与行车安全性。文档涵盖了完整的建模流程、控制策略设计、仿真验证方法及参数整定过程,并提供了详实的参考文献支持,增强了研究的可复现性与工程应用价值。; 适合人群:具备车辆工程、自动化或控制理论等相关专业背景,熟悉MATLAB/Simulink与Carsim仿真环境的研究生、科研人员及汽车行业技术研发工程师。; 使用场景及目标:①用于ABS控制算法的教学讲解与科研实验;②支撑车辆制动性能优化、主动安全系统开发等实际工程应用;③为相关学术论文撰写、课题复现与技术创新提供理论依据与技术参考。; 阅读建议:建议读者结合所提供的仿真模型与参考文献,逐步运行并调试代码,重点关注滑移率计算逻辑、PID参数整定方法及联合仿真的数据交互机制,同时可尝试引入模糊控制、自适应控制等先进算法进行对比分析,以深入掌握ABS系统的控制精髓与优化路径。

荔枝科研社

高校如何利用技术转移数据分析优化成果转化路径?.docx

科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

MATLAB采用改进的PSO实现AUV三维路径规划,配备自适应惯性权重、距离演化因子和跳出机制。.zip

MATLAB采用改进的PSO实现AUV三维路径规划,配备自适应惯性权重、距离演化因子和跳出机制。.zip

海神之光
评论 8
收藏 已收藏
分享
返回顶部
morphia
Delphi 5,944 成员 262,941 内容