Defines an object that can listen for free component notifications for a non-component object. This class allows non-TComponent descendants to use the automatic memory management of TComponent
Namespace: RefCount
TComponent
RefCount.TComponentNexus
|
Delphi
|
type
TComponentNexus = class(TComponent)
end;
|
|
Name
|
Description
|
|
OnNotification
|
Occurs when the component nexus receives a notification from a component (use FreeNotification to ask a component to send a notification when it is freed)
|
Top
|
To use the class, create an instance of the class and set the OnNotification event handler to notify the owning class:
Delphi
|
begin
// in constructor
FNexus := TComponentNexus.Create(nil); // free in destroy
FNexus.OnNotification := Notification;
if Engine <> nil then
FNexus.FreeNotification(Engine); // engine will notify us when it is freed
end;
|
|