Einzelnen Beitrag anzeigen

christian_r
(Gast)

n/a Beiträge
 
#8

Re: EntwZeit - Subkomponente löschen - Exception wird ausgel

  Alt 3. Mai 2008, 13:41
Delphi-Quellcode:
unit DkComponent;

interface

uses
  Classes, StdCtrls;

type
  TDkComponent = class( TComponent )
   private
    FComboBox : TComboBox;
   protected
    procedure Notification
              ( pComponent : TComponent; pOperation : TOperation );
              reintroduce;
              virtual;
   published
    property ComboBox
              : TComboBox
              read FComboBox
              write FComboBox;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents( 'Test', [ TDkMailAccount ] );
end;

{ TDkComponent }
procedure TDkComponent.Notification
          ( pComponent : TComponent; pOperation : TOperation );
begin
  inherited Notification( pComponent, pOperation );
  if ( pOperation = opRemove )
     and ( FComboBox <> nil )
     and ( pComponent = Self.ComboBox ) then
    Self.ComboBox := nil;
end;

end.
Jetzt funktioniert das Löschen ohne Exception. Und die geebrte "Notifcation" werde ich mir noch mal ganz in Ruhe ansehen. Man kann ja nur daraus lernen.

Wirklich vielen Dank für die Unterstützung.
  Mit Zitat antworten Zitat