Event Loop
Jump to navigation
Jump to search
Main Event Loop
The principal control loop for applications that are driven by events.
From the time it's launched until the moment it's terminated, an application gets one keyboard or mouse event after another from the Window Server and responds to them, waiting between events if the next event isn't ready. In the Application Kit, the NSApplication object runs the main event loop.
Modal Event Loop
A temporary event loop that's set up to get events directly from the event queue, bypassing the main event loop.
Typically, a mouse-down event initiates the modal loop and the following mouse-up event ends it. The loop gets mouse-dragged events (or mouse-entered and mouse-exited events) to track the cursor's movement while the user holds the mouse button down.