K
kusanagi
Unregistered / Unconfirmed
GUEST, unregistred user!
整个控件由三个文件组成:
定义控件的单元
MyDialog=(TComponent)
...
Selected: TMySelected;
end;
implementation
......
定义TMySelected单元。
TMySelected=(TObject)
...
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
定义PeropertyEditor单元
TSelectedEditor = class(TClassProperty)
private
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
function TSelectedEditor.GetAttributes: TPropertyAttributes;
begin
result:= [paDialog];
end;
procedure TSelectedEditor.Edit;
begin
SelectedEditorFrm:= TSelectedEditorFrm.Create(Application);
try
SelectedEditorFrm.SelectedEditor:= (GetComponent(0) as THrDialog).Selected;
SelectedEditorFrm.bbtnReset.OnClick:= (GetComponent(0) as THrDialog).ResetSelected;
SelectedEditorFrm.ShowModal;
finally
SelectedEditorFrm.Free;
end;
end;
现在的问题是Selected属性保存不上,或者说把控件放在Form上 and view text 的时候就没有看到这个属性???
谁能告诉我是为什么。
定义控件的单元
MyDialog=(TComponent)
...
Selected: TMySelected;
end;
implementation
......
定义TMySelected单元。
TMySelected=(TObject)
...
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
定义PeropertyEditor单元
TSelectedEditor = class(TClassProperty)
private
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
function TSelectedEditor.GetAttributes: TPropertyAttributes;
begin
result:= [paDialog];
end;
procedure TSelectedEditor.Edit;
begin
SelectedEditorFrm:= TSelectedEditorFrm.Create(Application);
try
SelectedEditorFrm.SelectedEditor:= (GetComponent(0) as THrDialog).Selected;
SelectedEditorFrm.bbtnReset.OnClick:= (GetComponent(0) as THrDialog).ResetSelected;
SelectedEditorFrm.ShowModal;
finally
SelectedEditorFrm.Free;
end;
end;
现在的问题是Selected属性保存不上,或者说把控件放在Form上 and view text 的时候就没有看到这个属性???
谁能告诉我是为什么。