Custom NSStatusItem with custom view - Use NSWindow, NSView, custom NSMenuItem?

Posted by Luc on Stack Overflow See other posts from Stack Overflow or by Luc
Published on 2009-11-10T04:21:41Z Indexed on 2010/03/22 18:11 UTC
Read the original article Hit count: 830

I'm trying to create a LSUIElement app that behaves like Spotlight, CoverSutra and other apps of that type. I managed to create a custom NSStatusItem, which popups up an NSWindow but the problem is that the app that currently has focus will the focus to my custom NSWindow.

I've based myself on Matt Gemmell's example (http://mattgemmell.com/2008/03/04/using-maattachedwindow-with-an-nsstatusitem)

For example, if you're in Safari and click on the Spotlight icon, the current Safari window does not gray out and keeps focused. When you press ESC in Spotlight, the focus is back to the Safari window.

I haven't managed to do this with my custom NSWindow. I have to click back on a window to set focus back to it.

So I'd like to know which route to go to achieve this. Is the solution a NSWindow, NSPanel, NSMenu with a custom NSMenuItem?

© Stack Overflow or respective owner

Related posts about nsstatusitem

Related posts about nsmenu