1. Welcome to the new MacRumors forums. See our announcement and read our FAQ


Discussion in 'Mac Programming' started by mbabauer, Sep 11, 2006.

  1. macrumors regular

    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.
  2. macrumors regular

    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.
  3. macrumors 68000


    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.
  4. macrumors regular

    That's cos you didn't get the one Cocoa book you need. By Yacktman.

Share This Page