Re: Cocoa keyboard input
Re: Cocoa keyboard input
- Subject: Re: Cocoa keyboard input
- From: Paul Davis <email@hidden>
- Date: Tue, 25 May 2010 14:02:47 -0400
On Tue, May 25, 2010 at 1:38 PM, Michael Hopkins
<email@hidden> wrote:
Now, this special key-processing caveat aside, key events will get delivered to your plugin view if the window that your view is in has focus. In this case, key events are sent to the first responder of that window. If your view is not the first responder of the window, you will not get any key events.
How does your view become first responder? Any textfields that are in your AudioUnit view will automatically respond correctly. Once they are clicked in, they become first responder, and then key events are delivered directly to them. If you have custom objects that you expect to handle key events, then they need to be a subclass of NSResponder, and need to acceptFirstResponder events by overriding -acceptsFirstResponder and returning YES. Secondly, if you have your own mouseDown: handler, you need to make sure that clicking on your view sets the first responder of the window to your object:
michael - this might be true if the host is written entirely in cocoa. its not necessarily true if the host is written using another toolkit layered on top of cocoa. the responder chains defined by cocoa calls have absolutely no direct impact on a host written in GTK (which in turns sits on top of cocoa) - GTK pulls events directly from the event queue and does not permit them to be dispatched via cocoa mechanisms except under special circumstances. this would also be true of a host written with JUCE or Qt for example.
having said that, any key events that the host decides to forward to the plugin will likely be delivered to the first responder in the plugin window since this is the only reasonably defined target to send the event to. so, in spite of what i wrote above, the plugin should still be attempting to become the first responder. this will ensure that if the host does decide to forward them, they will go to the right place.
--p
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden