unit cwDemoControl;
interface
uses
SysUtils, Classes, Graphics, Controls;
type
TcwDemoControl =
class(TComponent)
private
FFocusControl: TWinControl;
FFont: TFont;
FZahl1: Integer;
FZahl2: Integer;
procedure SetFocusControl(Value: TWinControl);
protected
procedure Notification(AComponent: TComponent; Operation: TOperation);
override;
property FocusControl: TWinControl
read FFocusControl
write SetFocusControl;
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
published
property Font: TFont
read FFont
write FFont;
property Zahl1: Integer
read FZahl1
write FZahl1;
property Zahl2: Integer
read FZahl2
write FZahl2;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Eigene', [TcwDemoControl]);
end;
constructor TcwDemoControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FFont := TFont.Create;
end;
destructor TcwDemoControl.Destroy;
begin
FFont.Free;
inherited Destroy;
end;
procedure TcwDemoControl.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited;
if (Operation = opRemove)
and (AComponent = FFocusControl)
then
FFocusControl :=
nil;
end;
procedure TcwDemoControl.SetFocusControl(Value: TWinControl);
begin
FFocusControl := Value;
if Value <>
nil then Value.FreeNotification(Self);
end;
end.