4

Before I start I should say I know this seems like a long shot, however I figured it was worth a try.

One app I am working on right now is a Mac Statusbar App. It has a NSStatusItem in the menubar and when clicked it will display a custom window with a popover appearance (like on iPad or like Fantastical has on the mac.) Anyway I started testing this by inserting a single nsmenu item in the status items menu. The view has set clear color for the background color on its window. However this still doesn't quite work as you can see in the pic below

enter image description here

  1. There is still a small white thin line above and below the item
  2. The clear area isn't clear, its like it has a blur filter on it

Other than that, it works fantastically great. I just didn't know if anybody else has ever attempted anything like this before and figured out how to overcome these 2 issues which seem to be the only thing preventing this from working.

If there is no way to do this I may have to resort to using a custom view for the NSStatusItem so I can get the coordinates on screen to position my own window below the NSStatusItem.

Colin Wheeler
  • 3,343
  • 2
  • 21
  • 23
  • My question to you is: how did you get that part of the menu to be clear? My instinct is that this can't be avoided; `NSMenu` applies a blur filter to the background of its items regardless of what is drawn, but I'm interested in how you got here in the first place. Even if I use a clear view and stick it in an `NSMenuItem`, I still get a completely white background. Special code? – Itai Ferber Jun 09 '11 at 01:50
  • inside the nsmenuitem view you call [[self window] setBackgroundColor:[NSColor clearColor]] – Colin Wheeler Jun 09 '11 at 01:52
  • Interesting. I'll look into it... – Itai Ferber Jun 09 '11 at 02:25
  • That's weird. It doesn't seem to work for me. `[[[self.menuItem view] window] setBackgroundColor:[NSColor clearColor]]` in `-awakeFromNib` seems to have no effect. Example: http://cl.ly/3k1A02113g2T2j273H2N – Itai Ferber Jun 09 '11 at 02:34
  • If that doesn't work, I'd recommend a custom popover thing (or real popovers in Lion), instead of a menu. – jtbandes Jun 09 '11 at 06:31

1 Answers1

0

A fake window seems like a rather weird approach to this. Why not just pop up a regular window? I suggest MAAttachedWindow: http://mattgemmell.com/2007/10/03/maattachedwindow-nswindow-subclass

Enchilada
  • 3,859
  • 1
  • 36
  • 69
  • it adds a lot of complexity in the nsstatusitem in terms of having to use a custom nsview so that you can get the screen coordinates and position a window below it. I am not opposed to this, I knew it was a long shot, but I didn't know if there was a way to fake it this way. – Colin Wheeler Jun 09 '11 at 17:20