A:
unit MyEds;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;
type
TPropertyEditor = class(TButton)
private
{ Private declarations }
FStringStuff: TStrings;
protected
{ Protected declarations }
public
{ Public declarations }
constructor create(Aowner: TComponent); override;
destructor destroy; override;
procedure SetStrings(s: TStrings);
published
{ Published declarations }
property StringStuff: TStrings read FStringStuff
write SetStrings;
end;
procedure Register;
implementation
constructor TPropertyEditor.create(AOwner: TComponent);
begin
inherited create(AOwner);
FStringStuff := TStringList.create;
end;
destructor TPropertyEditor.destroy;
begin
FStringStuff.free; {Plugs the memory leak.}
inherited destroy;
end;
procedure TPropertyEditor.SetStrings(s: TStrings);
begin
if FStringStuff <> s then {This conditional is optional.}
FStringStuff.Assign(s);
end;
procedure Register;
begin
RegisterComponents('Lloyd', [TPropertyEditor]);
end;
end.