delpro
asked on
Try to create a component with a TStrings property
I try to create a comonent
When i put the component on a form and click on nstring I get an Abstract Error.
unit Str;
interface
uses
Windows, Messages, SysUtils, Classes, StdCtrls;
type
TStr = class(TComponent)
private
protected
astring : TStrings;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property nstring: TStrings READ astring WrITE astring;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Sample s', [TStr]);
end;
constructor TStr.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
astring := TStrings.Create;
end;
destructor TStr.Destroy;
begin
inherited Destroy;
end;
end.
When i put the component on a form and click on nstring I get an Abstract Error.
unit Str;
interface
uses
Windows, Messages, SysUtils, Classes, StdCtrls;
type
TStr = class(TComponent)
private
protected
astring : TStrings;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property nstring: TStrings READ astring WrITE astring;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Sample
end;
constructor TStr.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
astring := TStrings.Create;
end;
destructor TStr.Destroy;
begin
inherited Destroy;
end;
end.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.