TNotifyEvents

Methods Properties Classes and interfaces

The usual type of event in Delphi is a simple property that points to a method of a particular object. While this is efficient, it means that only one function can be called then the event is fired.

If several objects can be dependent on another, then it would be good if that object could notify the others when something has happened. With an "event multiplexer" the dependent objects subscribe to event calls (becoming observers) by supplying callback methods. When the event fires, the "event multiplexer" calls all methods that have subscribed to it.

By using a TNotifyEvents object instead, any number of objects can have their events called when an event fires.

NOTE: TNotifyEvents is deliberately not made to handle exceptions raised in calls to events. If you want to catch such exceptions, it is suggested that you subclass TNotifyEvents, override CallEvent and catch exceptions in there.