RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TComponent.ReferenceInterface Method

Establishes or removes internal links that cause this component to be notified when the implementer of a specified interface is destroyed.

Pascal
function ReferenceInterface(const I: IInterface; Operation: TOperation): Boolean;
C++
__fastcall Boolean ReferenceInterface(const IInterface I, TOperation Operation);

Component writers use ReferenceInterface to ensure that properties whose values are interfaces are informed when the objects that implement those interfaces are destroyed. This notification must be in place for a property whose value is an interface to be saved with the component in a form file (that is, for such a property to persist as a published property). 

I is an interface pointer that is the value of the published property of interest. 

Operation indicates whether the notification link to the implementer of the interface should be established (opInsert) or removed (opRemove). 

ReferenceInterface returns true if it is successful in establishing or removing the notification link. If ReferenceInterface returns false when called with Operation set to opInsert, the specified interface can't be stored as the value of a published property.

Note: A result of false does not necessarily indicate an error, merely that the interface can't be stored by the property streaming system. For example, ReferenceInterface returns false when the specified interface employs true reference counting, independent of component lifetimes.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!