TComponent is the common ancestor of all component classes.
Unit
Classes
Description
TComponent is the base class for all components. TComponent implements the following features:
Components are persistent objects that have the following capabilities:
IDE integration. The ability to appear on an IDE palette and be manipulated in a form designer.
Ownership. The ability to manage other components. If component A owns component B, then A is responsible for destroying B when A is destroyed.
Streaming and filing. Enhancements of the persistence features inherited from TPersistent.
COM support. Components can be converted into ActiveX controls or other COM objects using wizards provided with Windows products. Components can serve as wrappers for COM objects.
Ownership. The ability to manage other components. If component A owns component B, then A is responsible for destroying B when A is destroyed.
Streaming and filing. Enhancements of the persistence features inherited from TPersistent.
COM support. Components can be converted into ActiveX controls or other COM objects using wizards provided with Windows products. Components can serve as wrappers for COM objects.
COM features are present in all implementations of TComponent, including those provided with Linux development tools. However, these features are only useful in Windows applications, and are marked in this documentation as "Windows only". Do not use these features in cross-platform applications.
TComponent does not provide any user interface or display features. These features are provided by two classes that directly descend from TComponent.
TControl, in the QControls unit, is the base class for "visual" components in cross-platform applications.
TControl, in the Controls unit, is the base class for "visual" components in Windows-only applications.
The Controls unit and other Windows-specific units are not provided with Linux development tools.
Components that can be visible at runtime are sometimes called "visual components". Other components, which are never visible at runtime, are sometimes called "non-visual components". However it is more common to refer to "visual components" as "controls" and "non-visual components" simply as "components."
Do not create instances of TComponent. Use TComponent as a base class when declaring non-visual components that can appear on the component palette and be used in the form designer. Properties and methods of TComponent provide basic behavior that descendant classes inherit as well as behavior that components can override to customize their behavior.
- TComponent = class(TPersistent, IInterface, IInterfaceComponentReference)
- private
- FOwner: TComponent; //所属
- FName: TComponentName;
- FTag: Longint;
- FComponents: TList;
- FFreeNotifies: TList;
- FDesignInfo: Longint;
- FComponentState: TComponentState;
- FVCLComObject: Pointer;
- function GetComObject: IUnknown;
- function GetComponent(AIndex: Integer): TComponent;
- function GetComponentCount: Integer;
- function GetComponentIndex: Integer;
- procedure Insert(AComponent: TComponent);
- procedure ReadLeft(Reader: TReader);
- procedure ReadTop(Reader: TReader);
- procedure Remove(AComponent: TComponent);
- procedure RemoveNotification(AComponent: TComponent);
- procedure SetComponentIndex(Value: Integer);
- procedure SetReference(Enable: Boolean);
- procedure WriteLeft(Writer: TWriter);
- procedure WriteTop(Writer: TWriter);
- { IInterfaceComponentReference }
- function IInterfaceComponentReference.GetComponent = IntfGetComponent;
- function IntfGetComponent: TComponent;
- protected
- FComponentStyle: TComponentStyle;
- procedure ChangeName(const NewName: TComponentName);
- procedure DefineProperties(Filer: TFiler); override;
- procedure GetChildren(Proc: TGetChildProc; Root: TComponent); dynamic;
- function GetChildOwner: TComponent; dynamic;
- function GetChildParent: TComponent; dynamic;
- function GetOwner: TPersistent; override;
- procedure Loaded; virtual;
- procedure Notification(AComponent: TComponent;
- Operation: TOperation); virtual; //发送消息
- procedure PaletteCreated; dynamic;
- procedure ReadState(Reader: TReader); virtual;
- procedure SetAncestor(Value: Boolean);
- procedure SetDesigning(Value: Boolean; SetChildren: Boolean = True);
- procedure SetInline(Value: Boolean);
- procedure SetDesignInstance(Value: Boolean);
- procedure SetName(const NewName: TComponentName); virtual;
- procedure SetChildOrder(Child: TComponent; Order: Integer); dynamic;
- procedure SetParentComponent(Value: TComponent); dynamic;
- procedure Updating; dynamic;
- procedure Updated; dynamic;
- class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); virtual;
- procedure ValidateRename(AComponent: TComponent;
- const CurName, NewName: string); virtual; //确定是否有重名组件存在
- procedure ValidateContainer(AComponent: TComponent); dynamic;
- procedure ValidateInsert(AComponent: TComponent); dynamic;
- procedure WriteState(Writer: TWriter); virtual;
- { IInterface }
- function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall;
- function _AddRef: Integer; stdcall;
- function _Release: Integer; stdcall;
- { IDispatch }
- function GetTypeInfoCount(out Count: Integer): HResult; stdcall;
- function GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult; stdcall;
- function GetIDsOfNames(const IID: TGUID; Names: Pointer;
- NameCount, LocaleID: Integer; DispIDs: Pointer): HResult; stdcall;
- function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer;
- Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult; stdcall;
- public
- constructor Create(AOwner: TComponent); virtual;
- destructor Destroy; override;
- procedure BeforeDestruction; override;
- procedure DestroyComponents;
- procedure Destroying;
- function ExecuteAction(Action: TBasicAction): Boolean; dynamic;
- function FindComponent(const AName: string): TComponent;
- procedure FreeNotification(AComponent: TComponent);
- procedure RemoveFreeNotification(AComponent: TComponent);
- procedure FreeOnRelease;
- function GetParentComponent: TComponent; dynamic;
- function GetNamePath: string; override;
- function HasParent: Boolean; dynamic;
- procedure InsertComponent(AComponent: TComponent);
- procedure RemoveComponent(AComponent: TComponent);
- procedure SetSubComponent(IsSubComponent: Boolean);
- function SafeCallException(ExceptObject: TObject;
- ExceptAddr: Pointer): HResult; override;
- function UpdateAction(Action: TBasicAction): Boolean; dynamic;
- function IsImplementorOf(const I: IInterface): Boolean;
- function ReferenceInterface(const I: IInterface; Operation: TOperation): Boolean;
- property ComObject: IUnknown read GetComObject;
- property Components[Index: Integer]: TComponent read GetComponent;
- property ComponentCount: Integer read GetComponentCount;
- property ComponentIndex: Integer read GetComponentIndex write SetComponentIndex;
- property ComponentState: TComponentState read FComponentState;
- property ComponentStyle: TComponentStyle read FComponentStyle;
- property DesignInfo: Longint read FDesignInfo write FDesignInfo;
- property Owner: TComponent read FOwner;
- property VCLComObject: Pointer read FVCLComObject write FVCLComObject;
- published
- property Name: TComponentName read FName write SetName stored False;
- property Tag: Longint read FTag write FTag default 0;
- end;
- { TComponent }
- constructor TComponent.Create(AOwner: TComponent);
- begin
- FComponentStyle := [csInheritable];
- if AOwner <> nil then AOwner.InsertComponent(Self); //新增
- end;
- destructor TComponent.Destroy;
- begin
- Destroying;
- if FFreeNotifies <> nil then
- begin
- while Assigned(FFreeNotifies) and (FFreeNotifies.Count > 0) do
- TComponent(FFreeNotifies[FFreeNotifies.Count - 1]).Notification(Self, opRemove);
- FreeAndNil(FFreeNotifies);
- end;
- DestroyComponents;
- if FOwner <> nil then FOwner.RemoveComponent(Self);
- inherited Destroy;
- end;
- procedure TComponent.BeforeDestruction;
- begin
- if not (csDestroying in ComponentState) then
- Destroying;
- end;
- procedure TComponent.FreeNotification(AComponent: TComponent);
- begin
- if (Owner = nil) or (AComponent.Owner <> Owner) then
- begin
- // Never acquire a reference to a component that is being deleted.
- assert(not (csDestroying in (ComponentState + AComponent.ComponentState)));
- if not Assigned(FFreeNotifies) then FFreeNotifies := TList.Create;
- if FFreeNotifies.IndexOf(AComponent) < 0 then
- begin
- FFreeNotifies.Add(AComponent);
- AComponent.FreeNotification(Self);
- end;
- end;
- Include(FComponentState, csFreeNotification);
- end;
- procedure TComponent.ReadLeft(Reader: TReader);
- begin
- LongRec(FDesignInfo).Lo := Reader.ReadInteger;
- end;
- procedure TComponent.ReadTop(Reader: TReader);
- begin
- LongRec(FDesignInfo).Hi := Reader.ReadInteger;
- end;
- procedure TComponent.WriteLeft(Writer: TWriter);
- begin
- Writer.WriteInteger(LongRec(FDesignInfo).Lo);
- end;
- procedure TComponent.WriteTop(Writer: TWriter);
- begin
- Writer.WriteInteger(LongRec(FDesignInfo).Hi);
- end;
- procedure TComponent.Insert(AComponent: TComponent);
- begin
- if FComponents = nil then FComponents := TList.Create;
- FComponents.Add(AComponent);
- AComponent.FOwner := Self;
- end;
- procedure TComponent.Remove(AComponent: TComponent);
- begin
- AComponent.FOwner := nil;
- FComponents.Remove(AComponent);
- if FComponents.Count = 0 then
- begin
- FComponents.Free;
- FComponents := nil;
- end;
- end;
- procedure TComponent.InsertComponent(AComponent: TComponent);
- begin
- AComponent.ValidateContainer(Self);
- ValidateRename(AComponent, '', AComponent.FName);
- Insert(AComponent);
- AComponent.SetReference(True);
- if csDesigning in ComponentState then
- AComponent.SetDesigning(True);
- Notification(AComponent, opInsert); //发送消息
- end;
- procedure TComponent.RemoveComponent(AComponent: TComponent);
- begin
- ValidateRename(AComponent, AComponent.FName, '');
- Notification(AComponent, opRemove);
- AComponent.SetReference(False);
- Remove(AComponent);
- end;
- procedure TComponent.DestroyComponents;
- var
- Instance: TComponent;
- begin
- while FComponents <> nil do
- begin
- Instance := FComponents.Last;
- if (csFreeNotification in Instance.FComponentState)
- or (FComponentState * [csDesigning, csInline] = [csDesigning, csInline]) then
- RemoveComponent(Instance)
- else
- Remove(Instance);
- Instance.Destroy;
- end;
- end;
- procedure TComponent.Destroying;
- var
- I: Integer;
- begin
- if not (csDestroying in FComponentState) then
- begin
- Include(FComponentState, csDestroying);
- if FComponents <> nil then
- for I := 0 to FComponents.Count - 1 do
- TComponent(FComponents[I]).Destroying;
- end;
- end;
- procedure TComponent.RemoveNotification(AComponent: TComponent);
- begin
- if FFreeNotifies <> nil then
- begin
- FFreeNotifies.Remove(AComponent);
- if FFreeNotifies.Count = 0 then
- begin
- FFreeNotifies.Free;
- FFreeNotifies := nil;
- end;
- end;
- end;
- procedure TComponent.RemoveFreeNotification(AComponent: TComponent);
- begin
- RemoveNotification(AComponent);
- AComponent.RemoveNotification(Self);
- end;
- procedure TComponent.Notification(AComponent: TComponent;
- Operation: TOperation);
- var
- I: Integer;
- begin
- if (Operation = opRemove) and (AComponent <> nil) then
- RemoveFreeNotification(AComponent);
- if FComponents <> nil then
- begin
- I := FComponents.Count - 1;
- while I >= 0 do
- begin
- TComponent(FComponents[I]).Notification(AComponent, Operation);
- Dec(I);
- if I >= FComponents.Count then
- I := FComponents.Count - 1;
- end;
- end;
- end;
- procedure TComponent.DefineProperties(Filer: TFiler);
- var
- Ancestor: TComponent;
- Info: Longint;
- begin
- Info := 0;
- Ancestor := TComponent(Filer.Ancestor);
- if Ancestor <> nil then Info := Ancestor.FDesignInfo;
- Filer.DefineProperty('Left', ReadLeft, WriteLeft,
- LongRec(FDesignInfo).Lo <> LongRec(Info).Lo);
- Filer.DefineProperty('Top', ReadTop, WriteTop,
- LongRec(FDesignInfo).Hi <> LongRec(Info).Hi);
- end;
- function TComponent.HasParent: Boolean;
- begin
- Result := False;
- end;
- procedure TComponent.GetChildren(Proc: TGetChildProc; Root: TComponent);
- begin
- end;
- function TComponent.GetChildOwner: TComponent;
- begin
- Result := nil;
- end;
- function TComponent.GetChildParent: TComponent;
- begin
- Result := Self;
- end;
- function TComponent.GetNamePath: string;
- begin
- Result := FName;
- end;
- function TComponent.GetOwner: TPersistent;
- begin
- Result := FOwner;
- end;
- procedure TComponent.SetChildOrder(Child: TComponent; Order: Integer);
- begin
- end;
- function TComponent.GetParentComponent: TComponent;
- begin
- Result := nil;
- end;
- procedure TComponent.SetParentComponent(Value: TComponent);
- begin
- end;
- procedure TComponent.Updating;
- begin
- Include(FComponentState, csUpdating);
- end;
- procedure TComponent.Updated;
- begin
- Exclude(FComponentState, csUpdating);
- end;
- procedure TComponent.Loaded;
- begin
- Exclude(FComponentState, csLoading);
- end;
- procedure TComponent.PaletteCreated;
- begin
- // Notification
- end;
- procedure TComponent.ReadState(Reader: TReader);
- begin
- Reader.ReadData(Self);
- end;
- procedure TComponent.WriteState(Writer: TWriter);
- begin
- Writer.WriteData(Self);
- end;
- procedure TComponent.ValidateRename(AComponent: TComponent;
- const CurName, NewName: string);
- begin
- if (AComponent <> nil) and not SameText(CurName, NewName) and
- (AComponent.Owner = Self) and (FindComponent(NewName) <> nil) then
- raise EComponentError.CreateResFmt(@SDuplicateName, [NewName]);
- if (csDesigning in ComponentState) and (Owner <> nil) then
- Owner.ValidateRename(AComponent, CurName, NewName);
- end;
- procedure TComponent.ValidateContainer(AComponent: TComponent);
- begin
- AComponent.ValidateInsert(Self);
- end;
- procedure TComponent.ValidateInsert(AComponent: TComponent);
- begin
- end;
- function TComponent.FindComponent(const AName: string): TComponent;
- var
- I: Integer;
- begin
- if (AName <> '') and (FComponents <> nil) then
- for I := 0 to FComponents.Count - 1 do
- begin
- Result := FComponents[I];
- if SameText(Result.FName, AName) then Exit;
- end;
- Result := nil;
- end;
- procedure TComponent.SetName(const NewName: TComponentName);
- begin
- if FName <> NewName then
- begin
- if (NewName <> '') and not IsValidIdent(NewName) then
- raise EComponentError.CreateResFmt(@SInvalidName, [NewName]);
- if FOwner <> nil then
- FOwner.ValidateRename(Self, FName, NewName) else
- ValidateRename(nil, FName, NewName);
- SetReference(False);
- ChangeName(NewName);
- SetReference(True);
- end;
- end;
- procedure TComponent.ChangeName(const NewName: TComponentName);
- begin
- FName := NewName;
- end;
- function TComponent.GetComponentIndex: Integer;
- begin
- if (FOwner <> nil) and (FOwner.FComponents <> nil) then
- Result := FOwner.FComponents.IndexOf(Self) else
- Result := -1;
- end;
- function TComponent.GetComponent(AIndex: Integer): TComponent;
- begin
- if FComponents = nil then TList.Error(@SListIndexError, AIndex);
- Result := FComponents[AIndex];
- end;
- function TComponent.GetComponentCount: Integer;
- begin
- if FComponents <> nil then
- Result := FComponents.Count else
- Result := 0;
- end;
- procedure TComponent.SetComponentIndex(Value: Integer);
- var
- I, Count: Integer;
- begin
- if FOwner <> nil then
- begin
- I := FOwner.FComponents.IndexOf(Self);
- if I >= 0 then
- begin
- Count := FOwner.FComponents.Count;
- if Value < 0 then Value := 0;
- if Value >= Count then Value := Count - 1;
- if Value <> I then
- begin
- FOwner.FComponents.Delete(I);
- FOwner.FComponents.Insert(Value, Self);
- end;
- end;
- end;
- end;
- procedure TComponent.SetAncestor(Value: Boolean);
- var
- I: Integer;
- begin
- if Value then
- Include(FComponentState, csAncestor) else
- Exclude(FComponentState, csAncestor);
- for I := 0 to ComponentCount - 1 do
- Components[I].SetAncestor(Value);
- end;
- procedure TComponent.SetDesigning(Value, SetChildren: Boolean);
- var
- I: Integer;
- begin
- if Value then
- Include(FComponentState, csDesigning) else
- Exclude(FComponentState, csDesigning);
- if SetChildren then
- for I := 0 to ComponentCount - 1 do Components[I].SetDesigning(Value);
- end;
- procedure TComponent.SetInline(Value: Boolean);
- begin
- if Value then
- Include(FComponentState, csInline) else
- Exclude(FComponentState, csInline);
- end;
- procedure TComponent.SetDesignInstance(Value: Boolean);
- begin
- if Value then
- Include(FComponentState, csDesignInstance) else
- Exclude(FComponentState, csDesignInstance);
- end;
- procedure TComponent.SetReference(Enable: Boolean);
- var
- Field: ^TComponent;
- begin
- if FOwner <> nil then
- begin
- Field := FOwner.FieldAddress(FName);
- if Field <> nil then
- if Enable then Field^ := Self else Field^ := nil;
- end;
- end;
- function TComponent.ExecuteAction(Action: TBasicAction): Boolean;
- begin
- Result := Action.HandlesTarget(Self);
- if Result then
- Action.ExecuteTarget(Self);
- end;
- function TComponent.UpdateAction(Action: TBasicAction): Boolean;
- begin
- Result := Action.HandlesTarget(Self);
- if Result then
- Action.UpdateTarget(Self);
- end;
- procedure TComponent.SetSubComponent(IsSubComponent: Boolean);
- begin
- if IsSubComponent then
- Include(FComponentStyle, csSubComponent)
- else
- Exclude(FComponentStyle, csSubComponent);
- end;
- function TComponent.GetComObject: IUnknown;
- begin
- if FVCLComObject = nil then
- begin
- if Assigned(CreateVCLComObjectProc) then CreateVCLComObjectProc(Self);
- if FVCLComObject = nil then
- raise EComponentError.CreateResFmt(@SNoComSupport, [ClassName]);
- end;
- IVCLComObject(FVCLComObject).QueryInterface(IUnknown, Result);
- end;
- function TComponent.SafeCallException(ExceptObject: TObject;
- ExceptAddr: Pointer): HResult;
- begin
- if FVCLComObject <> nil then
- Result := IVCLComObject(FVCLComObject).SafeCallException(
- ExceptObject, ExceptAddr)
- {$IFDEF LINUX}
- {$IFDEF _WIN32};{$ENDIF}
- if ExceptObject is Exception then
- begin
- SetSafeCallExceptionMsg(Exception(ExceptObject).Message);
- SetSafeCallExceptionAddr(ExceptAddr);
- Result := HResult($8000FFFF);
- end
- {$ENDIF}
- else
- Result := inherited SafeCallException(ExceptObject, ExceptAddr);
- end;
- procedure TComponent.FreeOnRelease;
- begin
- if FVCLComObject <> nil then IVCLComObject(FVCLComObject).FreeOnRelease;
- end;
- class procedure TComponent.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
- begin
- end;
- { TComponent.IInterface }
- function TComponent.QueryInterface(const IID: TGUID; out Obj): HResult;
- begin
- if FVCLComObject = nil then
- begin
- if GetInterface(IID, Obj) then Result := S_OK
- else Result := E_NOINTERFACE
- end
- else
- Result := IVCLComObject(FVCLComObject).QueryInterface(IID, Obj);
- end;
- function TComponent._AddRef: Integer;
- begin
- if FVCLComObject = nil then
- Result := -1 // -1 indicates no reference counting is taking place
- else
- Result := IVCLComObject(FVCLComObject)._AddRef;
- end;
- function TComponent._Release: Integer;
- begin
- if FVCLComObject = nil then
- Result := -1 // -1 indicates no reference counting is taking place
- else
- Result := IVCLComObject(FVCLComObject)._Release;
- end;
- { TComponent.IDispatch }
- function TComponent.GetTypeInfoCount(out Count: Integer): HResult;
- begin
- if FVCLComObject = nil then
- Result := E_NOTIMPL
- else
- Result := IVCLComObject(FVCLComObject).GetTypeInfoCount(Count);
- end;
- function TComponent.GetTypeInfo(Index, LocaleID: Integer; out TypeInfo): HResult;
- begin
- if FVCLComObject = nil then
- Result := E_NOTIMPL
- else
- Result := IVCLComObject(FVCLComObject).GetTypeInfo(
- Index, LocaleID, TypeInfo);
- end;
- function TComponent.GetIDsOfNames(const IID: TGUID; Names: Pointer;
- NameCount, LocaleID: Integer; DispIDs: Pointer): HResult;
- begin
- if FVCLComObject = nil then
- Result := E_NOTIMPL
- else
- Result := IVCLComObject(FVCLComObject).GetIDsOfNames(IID, Names,
- NameCount, LocaleID, DispIDs);
- end;
- function TComponent.Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer;
- Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult;
- begin
- if FVCLComObject = nil then
- Result := E_NOTIMPL
- else
- Result := IVCLComObject(FVCLComObject).Invoke(DispID, IID, LocaleID,
- Flags, Params, VarResult, ExcepInfo, ArgErr);
- end;
- { TComponent.IInterfaceComponentReference.GetComponent
- Return a reference to the component that can be queried at load time to
- obtain an interface. The name of the reference component will be written to
- the stream (same as a normal component reference) so that it can be located
- again at load time.
- In the case of aggregation, the reference component for an interface might
- not be the same as the class that implements the interface itself.
- Aggregate implementation classes should not implement
- IInterfaceComponentReference, but should defer requests for that interface
- to the controlling component.
- }
- function TComponent.IntfGetComponent: TComponent;
- begin
- Result := Self;
- end;
- function TComponent.IsImplementorOf(const I: IInterface): Boolean;
- var
- ICR: IInterfaceComponentReference;
- begin
- Result := (I <> nil) and Supports(I, IInterfaceComponentReference, ICR)
- and (ICR.GetComponent = Self);
- end;
- { TComponent.ReferenceInterface
- Establishes (opInsert) or removes (opRemove) internal links that
- notify us when the component that implements the given interface is
- destroyed. The function result indicates whether the function was able
- to establish/remove a notification link or not. A result of False
- doesn't necessarily indicate an error, but it does mean that the
- interface's implementor does not participate in the interfaced component
- reference model. This could mean that the given interface employs true
- reference counting, independent of component lifetimes. That doesn't
- affect the use of interface properties at runtime, but non-component
- interfaces cannot be stored by the property streaming system.
- When implementing components with interface-type properties, implement
- setter methods for the interface-type properties like this:
- procedure TMyComponent.SetMyIntfProp(const Value: IMyInterface);
- begin
- ReferenceInterface(FIntfField, opRemove);
- FIntfField := Value;
- ReferenceInterface(FIntfField, opInsert);
- end;
- Also override Notification to do the following for each interface property
- in your component:
- procedure TMyComponent.Notification(AComponent: TComponent; Operation: TOperation);
- begin
- inherited;
- if Assigned(MyIntfProp) and AComponent.IsImplementorOf(MyIntfProp) then
- MyIntfProp := nil;
- ... repeat for other interface properties ...
- end;
- Note that the Notification code assigns nil to the *property*, not to the
- private field, so that the property setter will call
- ReferenceInterface(FIntfField, opRemove to undo any links established by
- a previous opInsert operation. All assignments to the interface property
- *must* be made through the property setter.
- TComponent.ReferenceInterface hides the details of how links are
- established between the implementor and the holder of an interface.
- The implementation details may change in the future. Code that relies
- on those implementation details (instead of using ReferenceInterface)
- will not be supported. In particular, avoid the temptation to use
- IInterfaceComponentReference in your own code, as this interface may
- not be available in the future.
- }
- function TComponent.ReferenceInterface(const I: IInterface; Operation: TOperation): Boolean;
- var
- ICR: IInterfaceComponentReference;
- begin
- Result := (I <> nil) and Supports(I, IInterfaceComponentReference, ICR);
- if Result then
- if Operation = opInsert then
- ICR.GetComponent.FreeNotification(Self)
- else
- ICR.GetComponent.RemoveFreeNotification(Self);
- end;