Re: How can I detect a mouse click outside a child window on Leopard?
Re: How can I detect a mouse click outside a child window on Leopard?
- Subject: Re: How can I detect a mouse click outside a child window on Leopard?
- From: Uli Kusterer <email@hidden>
- Date: Wed, 15 Feb 2012 10:14:57 +0100
On 14.02.2012, at 14:39, Michael Crawford wrote:
> I was just looking at the documentation for NSApplication and wondering if overriding sendEvent is the way to go? I was thinking I could monitor events dispatched to my app and then, when one arrives that is not destined for the child window, dismiss the popover. I can also dismiss the popover if the application loses focus.
Might be a bit hard to avoid dismissing on clicks in the menu bar though ... but I might be mixing that up with Carbon. Does sendEvent: get menu bar clicks?
But yeah, that's what I would use. I thought there was a way to install an event filtering/monitoring callback on NSApplication, but I can't find the call right now. Anyway, it's probably 10.7-only, at best 10.6.
Failing that, you could create a transparent, borderless window with a custom content view that handles mouse clicks and closes your fake popover (and itself), I suppose. Might have to call -preventWindowOrdering in there too, in case someone uses Spaces or Exposé to select your blanking window or otherwise screw up window ordering.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.masters-of-the-void.com
_______________________________________________
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