• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Chaging NSStatusItem menus.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Chaging NSStatusItem menus.


  • Subject: Re: Chaging NSStatusItem menus.
  • From: Jeremy <email@hidden>
  • Date: Mon, 25 Feb 2008 16:50:00 -0500

August,

If you would like to send me your code that would be helpful. But I do my menu bar programatically due to the actual nature of my status bar...

I.S.,

Here's my code to quit iTunes. barItem is the NSStatusItem, iTunes is the Scripting Bridge iTunes Framework, and iTunesQuit is the new menu I want.

- (void)quitItunes:(id)sender
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[iTunes quit];
iTunesQuit = [[NSMenu alloc] initWithTitle:@""];
qOne = [iTunesQuit addItemWithTitle:@"Start Watching iTunes Again" action:@selector(beginWatching:) keyEquivalent:@""];
[barItem setTitle:@"Start iTunes"];
//[barItem setAction:@selector(beginWatching:)];
[barItem setMenu:iTunesQuit];
//[[NSApplication sharedApplication] terminate:self];
}


Thanks,
Jeremy
"For a long time it puzzled me how something so expensive, so leading edge, could be so useless, and then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match." - Bill Bryson



On Feb 25, 2008, at 4:44 PM, August Trometer wrote:

I just threw together a quick sample project, and I didn't have any trouble switching menus.

Simply put:

I've got 2 menus, fooMenu and barMenu, both in IB. I have from my controller outlets connected to both. In the controller,

[statusItem setMenu:fooMenu];

and

[statusItem setMenu:barMenu];

both work flawlessly for me.

If you want the sample code, contact me offlist, and I'll send it to you.


-- August





On Feb 25, 2008, at 4:24 PM, Jeremy wrote:

Hello,

How can I switch menus for an NSStatusItem programatically? So if the user chooses to "quit" the application from the NSStatusItem I can switch it's menu to be another menu with launch options.

Thanks,
Jeremy


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Chaging NSStatusItem menus.
      • From: "I. Savant" <email@hidden>
References: 
 >Chaging NSStatusItem menus. (From: Jeremy <email@hidden>)
 >Re: Chaging NSStatusItem menus. (From: August Trometer <email@hidden>)

  • Prev by Date: Re: Chaging NSStatusItem menus.
  • Next by Date: Re: NSInvocation question
  • Previous by thread: Re: Chaging NSStatusItem menus.
  • Next by thread: Re: Chaging NSStatusItem menus.
  • Index(es):
    • Date
    • Thread