[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Classes' (#rtl)

# IFPObserved.FPOAttachObserver

Attach a new observer to the object

## Declaration

Source position: classesh.inc line 167

`procedure IFPObserved.FPOAttachObserver(`
`AObserver: TObject`
`);`

## Description

FPOAttachObserver must be called with an object instance AObserver that implements the IFPObserver interface. The FPOObservedChanged method of the interface will be called whenever FPONotifyObservers is used to notify observers of a change. Objects implementing this interface should check that AObserver actually implements the IFPObserver interface.

Do not make assumptions on how the interface behaves if FPOAttachObserver is called more than once with the same interface. It may add the object to the list of observers unconditionally (in which case it will be notified twice) or it may check that it is not yet in the list.

## Errors

If AObserver does not implement the IFPObserver interface, an EObserver exception must be raised. No other errors should be raised, other than a possible out of memory error.

## See also

IFPObserver |  | Interface for an object to observe other objects.
FPOObservedChanged |  | Entry point for change notifications
FPONotifyObservers