On Sep 4, 2012, at 8:20 AM, Graham Cox wrote: > On 04/09/2012, at 9:28 PM, Akhil Jindal <akhi...@gmail.com> 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.
This would only be appropriate for events that don't have an inherent position, like key events. For events from a tablet, which do have a position, the first responder is not the appropriate target. This is just like for a mouse. Certainly, you don't expect a click outside of the main or key window, or on a button when a text field is the first responder, to only go to the first responder, do you? Regards, Ken _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com