4
votes

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.

1
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
inside the nsmenuitem view you call [[self window] setBackgroundColor:[NSColor clearColor]]Colin Wheeler
Interesting. I'll look into it...Itai Ferber
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: cl.ly/3k1A02113g2T2j273H2NItai Ferber
If that doesn't work, I'd recommend a custom popover thing (or real popovers in Lion), instead of a menu.jtbandes

1 Answers

0
votes

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