Re: Figuring out which NSView to send an event to
Re: Figuring out which NSView to send an event to
- Subject: Re: Figuring out which NSView to send an event to
- From: Graham Cox <email@hidden>
- Date: Tue, 04 Sep 2012 23:20:28 +1000
On 04/09/2012, at 9:28 PM, Akhil Jindal <email@hidden> wrote:
> Using NSWindowList, and iterating over them, I find the window to which the
> event should belong. Now I have to find the NSView within the window.
Ask the window for its firstResponder. That should be the object that events get directed to. It might not be a view but usually is. In any case it will be an NSResponder.
Rather than iterating over the windows it also would probably be better to ask NSApp for its mainWindow (or keyWindow) then that window's firstResponder.
--Graham
_______________________________________________
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