Instance Method

sendEvent:

Dispatches an event to other objects.

Declaration

- (void)sendEvent:(NSEvent *)event;

Parameters

anEvent

The event object to dispatch.

Discussion

You rarely invoke sendEvent: directly, although you might want to override this method to perform some action on every event. sendEvent: messages are sent from the main event loop (the run method). sendEvent: is the method that dispatches events to the appropriate responders—NSApp handles app events, the NSWindow object indicated in the event record handles window-related events, and mouse and key events are forwarded to the appropriate NSWindow object for further dispatching.

See Also

Managing the Event Loop

- nextEventMatchingMask:untilDate:inMode:dequeue:

Returns the next event matching a given mask, or nil if no such event is found before a specified expiration date.

- discardEventsMatchingMask:beforeEvent:

Removes all events matching the given mask and generated before the specified event.

currentEvent

The last event object that the app retrieved from the event queue.

running

A Boolean value indicating whether the main event loop is running.

- run

Starts the main event loop.

- finishLaunching

Activates the app, opens any files specified by the NSOpen user default, and unhighlights the app’s icon.

- stop:

Stops the main event loop.

- postEvent:atStart:

Adds a given event to the receiver’s event queue.

NSEventTrackingRunLoopMode

A run loop should be set to this mode when tracking events modally, such as a mouse-dragging loop.