unit ComponentEx;
interface
uses
Windows, Messages, SysUtils, Classes, ADODB;
type
TComponentEx = class(TComponent)
private
{ Private declarations }
FConnection : TADOConnection;
function GetConnection : TADOConnection;
procedure SetConnection(const Value: TADOConnection);
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
property Connection: TADOConnection read GetConnection write SetConnection;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TComponentEx]);
end;
{ TComponentEx }
constructor TComponentEx.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FConnection := nil;
end;
function TComponentEx.GetConnection: TADOConnection;
begin
Result := FConnection;
end;
procedure TComponentEx.SetConnection(const Value: TADOConnection);
begin
if FConnection <> Value then
begin
FConnection := Value;
end;
end;
end.