G
guchenyi
Unregistered / Unconfirmed
GUEST, unregistred user!
我已经添加此属性,但是在编译后,在object inspector 里面点击“...”这个按钮,照例应该
弹出编辑界面,可 每次报错:"cannot assign nil to a TRichEditSTring"
代码如下:
type
TMyCustomStringGrid = class(TStringGrid)
private
FColumncheck: TStrings;
FColNeedChecked: boolean;
procedure SetColCheck(Value: TStrings);
procedure GetChecked;
procedure SetChecked(checked: boolean);
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(AOwner: TComponent);
destructor Destroy;
{ Public declarations }
published
property ColCheck: TStrings read FColumncheck write SetColCheck;
property NeedChecked: boolean read FColNeedChecked write SetChecked;
{ Published declarations }
end;
procedure Register;
implementation
constructor TMyCustomStringGrid.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FColumncheck := TStringList.Create;
end;
destructor TMyCustomStringGrid.Destroy;
begin
inherited Destroy;
FColumncheck.Free;
end;
procedure TMyCustomStringGrid.GetChecked;
begin
NeedChecked := FColNeedChecked;
end;
procedure TMyCustomStringGrid.SetChecked(checked: boolean);
begin
FColNeedChecked := checked;
end;
procedure TMyCustomStringGrid.SetColCheck(Value: TStrings);
begin
FColumncheck.Assign(Value);
end;
弹出编辑界面,可 每次报错:"cannot assign nil to a TRichEditSTring"
代码如下:
type
TMyCustomStringGrid = class(TStringGrid)
private
FColumncheck: TStrings;
FColNeedChecked: boolean;
procedure SetColCheck(Value: TStrings);
procedure GetChecked;
procedure SetChecked(checked: boolean);
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(AOwner: TComponent);
destructor Destroy;
{ Public declarations }
published
property ColCheck: TStrings read FColumncheck write SetColCheck;
property NeedChecked: boolean read FColNeedChecked write SetChecked;
{ Published declarations }
end;
procedure Register;
implementation
constructor TMyCustomStringGrid.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FColumncheck := TStringList.Create;
end;
destructor TMyCustomStringGrid.Destroy;
begin
inherited Destroy;
FColumncheck.Free;
end;
procedure TMyCustomStringGrid.GetChecked;
begin
NeedChecked := FColNeedChecked;
end;
procedure TMyCustomStringGrid.SetChecked(checked: boolean);
begin
FColNeedChecked := checked;
end;
procedure TMyCustomStringGrid.SetColCheck(Value: TStrings);
begin
FColumncheck.Assign(Value);
end;