Download Now

    Reference TInterfacedFree

    Declared in Codebot.System.pas on line 942

    TInterfacedFree creates a connection between an interface and a component. When your interface is destroyed first then ReleaseComponent is invoked. You may override ReleaseComponent to perform housekeeping tasks such as unsubscribing from events on component. If the component is destroyed first then the corresponding component field automatically becomes nil.
    Note:
    If you override ReleaseComponent be sure to call the inherited method after you complete your housekeeping tasks.
      TInterfacedFree = class(TInterfacedObject)
      protected
        { Invoked when the interface is destroyed before the component. Override to
          unsubscribe from component events and call inherited last. }
        procedure ReleaseComponent; virtual;
      public
        { Holds a reference to a component until it is destroyed }
        Component: TComponent;
        { Create a connection to a component and begin watching for its destruction }
        constructor Create(AComponent: TComponent); virtual;
        { Calls ReleaseComponent if the component still exists }
        destructor Destroy; override;
      end;