From RAD Studio API Documentation
Jump to: navigation, search


function ReferenceInterface(const I: IInterface; Operation: TOperation): Boolean;


bool __fastcall ReferenceInterface(const System::_di_IInterface I, TOperation Operation);


Type Visibility Source Unit Parent
function public
System.Classes TComponent


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

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 cannot be stored as the value of a published property.

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

See Also