On Feb 15, 2012, at 1:14 AM, Uli Kusterer wrote:

> 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.


Unless I'm missing some requirement, this is all way way overly complicated.

Make the popover window key. Clicking anywhere outside of if will make the 
popover window lose key status. Just use that notification to know to close it. 
That's really all you need to do. 


--
Seth Willits

_______________________________________________

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

Reply via email to