Questions on this date back to 2003, so I've tried a lot of things.

I have an LSUIElement app, with an NSStatusItem and NSSearchField, and I'd much 
rather be using a menu item with a custom subview rather than showing a window 
when the status item gets clicked, because there's no way for the menubar to 
know that it got clicked and so in fullscreen the menubar slides out of the way 
even though the fake "menu" is still visible.

Plus it looks better that way.

The first time it runs from Xcode, everything's fine. [NSApp isActive] is true, 
the menu's window becomes key, search field and everything else accept mouse 
clicks and key events.

Switch to another app and switch back, NSApp is not active, and 
activateIgnoringOtherApps doesn't do anything no matter where I put it. The 
menu appears and some mouse events get handled, but the search field doesn't 
take focus, key strokes dismiss the menu, etc.

I did see one suggestion to have the statusItem's click handler call that and 
then call popUpStatusItemMenu:, that didn't work - the app didn't become 
active. The suggestion to delay the call to popUpStatusItemMenu until 
applicationDidBecomeActive sort of worked, but then the status item's menubar 
highlight got out of sync with the menu actually appearing.

What nearly worked was to watch for the menu's window isVisible changing and 
activate the app then, but I had to click the status item twice to get my menu.


_______________________________________________

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