First page Back Continue Last page Graphics
Event Handling
Various event-handling models:
Callbacks: Standalone functions associated with an event by calling a toolkit function. There are encapsulation problems.
Message based: Messages sent to windows for controlling behavior, or for events.
Virtual methods: One for each type of event. Solves encapsulation, but leads to clutter, inflexible classes, and many derived classes just to handle an event differently.
Static event tables: Events are associated with classes and methods at compile time via a table. When the event occurs the tables are searched for a match and the method is invoked.