Einzelnen Beitrag anzeigen

Tau

Registriert seit: 17. Mär 2003
Ort: Bludenz
221 Beiträge
 
Delphi 7 Enterprise
 
#14

Re: Zentrale Komponenten Verwaltung?

  Alt 4. Feb 2006, 19:29
Hallo zusammen

@Ferber

Der Code für TcwDemoControl schaut momentan so aus
Delphi-Quellcode:
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.
Tau
http://www.quad-offroad.com
wer kämpft kann verlieren aber wer nicht kämpft hat verloren
( Delphi 7 )
  Mit Zitat antworten Zitat