Re: Intercepting keyDown event from NSComboBox
Re: Intercepting keyDown event from NSComboBox
- Subject: Re: Intercepting keyDown event from NSComboBox
- From: "Kyle Sluder" <email@hidden>
- Date: Tue, 12 Feb 2008 20:23:02 -0500
On 2/12/08, Randall Meadows <email@hidden> wrote:
> Is there a better way to intercept keyDown events before the
> firstResponder gets a whack at it? (Assume that changing the actual
> UI/UE, at this point, is not an option.)
According to the Cocoa Event-Handling Guide, NSApplication receives
incoming events from the window server, and finds the approrpiate
window to handle the event. It then gives the event to the window,
which sends it to its first responder:
http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_3.html#//apple_ref/doc/uid/10000060i-CH3-SW4
The short answer: override -[NSWindow sendEvent:] and capture the
event before it gets dispatched to the first responder.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden