Jump to content

Event model

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by STBot (talk | contribs) at 01:03, 17 October 2006 (clean up using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The event model is a programming paradigm commonly used in building graphical user interfaces. A very common and very programmer-friendly variant is the delegate event model, which is provided by the most popular graphic frameworks.

Delegate event model

Delagate event model. Click me is the event source (a button in this example), and it contains a list of listeners.

This model is based on three entities:

Furthermore the model requires that:

  • every listener must implement the interface for the event it wants to listen to (done at programming time)
  • every listener must register with the source, to declare its desire to listen to some particular event (done at runtime)
  • every time the source generates an event, it communicates it to the registered listeners, following the protocol of the interface