Event handler
In computer programming, an event handler is an asynchronous callback subroutine that handles inputs received in a program. Each event is a piece of application-level information from the underlying framework , typically the GUI toolkit. GUI events include key presses, mouse movement, action selections, and timers expiring. On a lower level, events can represent availability of new data for reading a file or network stream. Event handlers are a central concept in event-driven programming.
The events are created by the framework based on interpreting lower-level inputs, which may be lower-level events themselves. For example, mouse movements and clicks are interpreted as menu selections. The events initially originate from actions on the operating system level, such as interrupts generated by hardware devices, software interrupt instructions, or state changes in polling. On this level, interrupt handlers and signal handlers correspond to event handlers.
Created events are first processed by an event dispatcher within the framework. It typically manages the associations between events and event handlers, and may queue event handlers or events for later processing. Event dispatchers may call event handlers directly, or wait for events to be dequeued with information about the handler to be executed.
Details
How any particular event handling system functions is highly dependent on the computer hardware, the operating system, the programming language , and the application program's environment. A programmer will need to consult the documentation provided in order to understand exactly how to use an event handling system. Users typically need only know how the interface to applications, windowing systems, and console terminals function.
See also
- Callback (computer science)
- Signal handler
- Interrupt handler
- Event-driven programming
- Observer pattern (e.g. Event listener)
- DOM Events
- Virtual synchrony
External links
- Write an Event Handler
- A High Level Design of the Sub-Farm Event Handler
- An Events Syntax for XML
- Java DOM Interface Event Javadoc documentation
javax.swing.event
Java package Javadoc API documentationjava.awt.event
Java package Javadoc API documentation- Distributed Events and Notifications
- Event order
- Supporting Three Event Models at Once
- Article Another Look at Events by Jasmin Blanchette
- Article Event Handlers and Callback Functions by Sjoerd Visscher
没有评论:
发表评论