自己写一个组件的一个属性如下:
private
FBody:TStrings;
...
procedure SetBody(MyBody:TStrings);
published
...
property Body:TStrings read FBody write SetBody;
注册好这个组件,放一个到窗体上,这时在属性编辑器窗口中点一下Body这个属性,
弹出Cannot assign a nil to a TRichEditStrings的错误。
请问怎样使用TStrings类型的属性??????????
private
FBody:TStrings;
...
procedure SetBody(MyBody:TStrings);
published
...
property Body:TStrings read FBody write SetBody;
注册好这个组件,放一个到窗体上,这时在属性编辑器窗口中点一下Body这个属性,
弹出Cannot assign a nil to a TRichEditStrings的错误。
请问怎样使用TStrings类型的属性??????????
解决方案 »
- 大虾们,借用一分钟。XML结果解析,汉字变非法字符
- ClientSocket 通讯控件问题
- 求所有记录的前三条记录的和.
- 求一份delphi调用webservice的代码,delphi版本越低越好最好是delphi6(能支持的话)
- Web Service打印问题
- 用bPL包,为什么还要DCU文件?没有怎么办?
- 如门后该怎样提高自己的delphi水平?请各位朋友介绍一下!
- 出錯信息﹕Counldn't perform the edit because another user changed the record
- windows 鼠标右键弹出菜单,在哪儿修改?
- 在SQL中有没有表示今天的日期函数,有没有四舍五入的数学函数?
- 数据库写入后的问题!
- 如何将dbgrid中的内容导出到Excel(事先没有这个Excel文件)?
参看:
constructor TCustomMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Width := 185;
Height := 89;
AutoSize := False;
FWordWrap := True;
FWantReturns := True;
FLines := TMemoStrings.Create;
TMemoStrings(FLines).Memo := Self;
end;
我两个都有.Create的.还是会出现Cannot assign a nil to a TRichEditStrings的错误!!!我要的是能够在设计期使用属性编辑器编辑TStrings类型的属性的值!
而且 不能用Tstrings创建实例,而要用TSTRINGLIST创建其实例
有个组件属性如下:
TMyClass=class(TComponent)
private
FPort:Integer;
procedure SetPort(Value:Integer);
published
property Port:Integer read FPort write SetPort;
public
Constructor create;
....
Constructor TMyClass.Create;
begin
FPort:=5050;
....
end;
按装好这个组件之后,拖一个放到窗体上,然后看看属性编辑器中的Port并不是5050
而是0.而我的目的是把它放在窗体上的时候port自动=5050.thanks!
=>
constructor Create(aOwner: TComponent); override;
已利于窗体设计器来调用