unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
extctrls, stdctrls;
type
ILsAssociate =
Interface
['
{9D77B5ED-5C4D-4725-BFC6-3089D57F218C}']
function GetAsso: TWincontrol;
procedure SetAsso(
const Value: TWincontrol);
property Associate: TWincontrol
read GetAsso
write SetAsso;
end;
TLsDummy =
class(TCustomControl,ILsAssociate)
private
FAssociate : TWincontrol;
protected
procedure SetAsso(
const Value: TWincontrol );
// implem. für Interface
function GetAsso : TWincontrol;
// dto.
end;
TLsDummyUser =
Class(TPanel)
private
FEdit : TEdit;
FDummy : ILsAssociate;
protected
public
constructor Create(AOwner : TComponent);
override;
published
end;
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
FDummySUer : TLsDummyUser;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TLsDummy }
function TLsDummy.GetAsso: TWincontrol;
begin
Result:=FAssociate;
end;
procedure TLsDummy.SetAsso(
const Value: TWincontrol);
begin
FAssociate:=Value;
end;
{ TLsDummyUser }
constructor TLsDummyUser.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FEdit:=TEdit.Create(Self);
FDummy:= TLsDummy.Create(Self);
FDummy.Associate:=FEdit;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FDummySUer:=TLsDummyUser.Create(self);
FDummySUer.Parent:=Self;
end;
end.