Unit 'fpobserver' Package
[Overview][Types][Classes][Procedures and functions][Index] [#fcl]

TObservedHook

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Observer pattern helper class implementing IFPObserved interface

Declaration

Source position: fpobserver.pp line 33

type TObservedHook = class(TObject,IFPObserved)

public

  constructor CreateSender();

  

Creates an observer hook with a specified sender object

  destructor Destroy; override;

  

Destroys the observer hook and notifies all observers

  procedure FPOAttachObserver();

  

Attaches an observer implementing IFPObserver interface

  procedure FPODetachObserver();

  

Detaches an observer from the notification list

  procedure Changed;

  

Notifies all observers that the object has changed

  procedure AddItem();

  

Notifies observers that an item was added

  procedure DeleteItem();

  

Notifies observers that an item was deleted

  procedure CustomNotify();

  

Sends custom notification to all observers

  procedure FPONotifyObservers();

  

Core method to notify all observers about operations

  property Sender: TObject; [r]

  

Default sender object for notifications

end;

Inheritance

TObservedHook

  

Observer pattern helper class implementing IFPObserved interface

|

TObject,IFPObserved

Description

The TObservedHook class provides a simple way to add observer pattern support to any object. It implements the IFPObserved interface and manages a list of observers that implement the IFPObserver interface.

Objects can use this class as a helper to notify observers about changes, item additions, deletions, or custom events. The class handles attaching and detaching observers automatically and provides methods for different types of notifications.

This class is intended to be used as a component within other classes that need to support observation, rather than being used directly as a standalone object.

See also

IFPObserver


Documentation generated on: Dec 15 2025