Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mbabauer

macrumors regular
Original poster
Feb 14, 2006
105
0
I am playing around with Cocoa, and read through a couple of books, but none of them show you how to add an app that runs in the Menubar (Task Tray???) like QuickSilver or Backlight does. Obviously it can be done, but how? A search in the Apple Developers docs for 'menubar' turns up a ton of references to Tk menus, but not really what I need.
 

mbabauer

macrumors regular
Original poster
Feb 14, 2006
105
0
Ok, finally got some leads in the docs and Google. There are actually two places this can be done, as an NSMenuExtras or as a NSStatusItem.

The problem is that apparently NSMenuExtras is a closed API, and NSStatusItem is not guaranteed to be there, as long menu items can overwrite status items if they need space.

There are some workarounds, although I am not clear how they fully work, but they seem to be more like hacks than legit code.

Anyone have any sample code that puts a Status Item up with no menu or window? I am trying to do something similar to QuickSilver (in layout, not functionality) where there is an icon on the right of the menu bar that does something when you click it.
 

savar

macrumors 68000
Jun 6, 2003
1,950
0
District of Columbia
mbabauer said:
The problem is that apparently NSMenuExtras is a closed API, and NSStatusItem is not guaranteed to be there, as long menu items can overwrite status items if they need space.

I had the same problem several years ago. Back then there were rumors that NSMenuExtras would be made public for 3rd party developers to use. Guesss that never happened.

Using NSStatusItem isn't too bad. I don't have the code anymore, but I think I found it on cocoadevcentral.com.
 

Fairly

macrumors regular
Sep 24, 2006
160
0
Cambridge UK
mbabauer said:
I am playing around with Cocoa, and read through a couple of books, but none of them show you how to add an app that runs in the Menubar
That's cos you didn't get the one Cocoa book you need. By Yacktman.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.