First page Back Continue Last page Graphics
Event Handling
Most, if not all, GUI systems and toolkits are designed to be event driven, meaning that the main flow of your program is not sequential from beginning to end.
When something happens that is of interest to you (an event), the system or toolkit calls a bit of your code that deals with that event (event handler).
When your event handler finishes, control returns to the “main loop” and your program waits for the next event.