Andrew Platzer (aep@apple.com)
Tue, 9 Feb 1999 17:12:29 -0800
> Hi, I want to use NSStatus class with an application that I am developing
> but the DR2 documentation is pretty minimal. I have reviewed the header
> files and cannot figure out how NSStatus (and NSStatusItem) work. If any
> one has an example they'd be willing to share I'd appreciate it. Thanks in
> advance. Nick Gustilo.
It's pretty easy. Let's say you want to just show an icon for a while. Say
something like:
NSStatusItem* item = [[[NSStatusBar systemStatusBar] statusItemWithLength:
NSVariableStatusItemLength] retain];
[item setImage:icon];
It should immediately appear in the system menu bar.
Then later on, remove it by saying:
[[NSStatusBar systemStatusBar] removeStatusItem:item];
[item release];
You can set an action/target and say [item setHighlightMode:YES] to turn
it into a button. You can also set its text, add a menu and enable or
disable it. If you want to hide it, set its length to 0 (you can't remove
it and add it in later.)
Better documentation will be in the next release.
Andrew Platzer
Application Frameworks
Apple Computer, Inc.
This archive was generated by hypermail 2.0b3 on Mon Oct 18 1999 - 00:11:39 PDT