• 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
Why does my menu have mutually exclusive states?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why does my menu have mutually exclusive states?


  • Subject: Why does my menu have mutually exclusive states?
  • From: Eric Gorr <email@hidden>
  • Date: Fri, 15 Jan 2010 14:41:44 -0500

I have some sample code at:

http://ericgorr.net/cocoadev/UtilityMenu.zip

According to the documentation in "Application Menu and Pop-up List Programming Topics for Cocoa", to get mutually exclusive states, one my manage this oneself:



You can use states to implement a group of mutually exclusive menu items, much like a group of radio buttons. For example, a game could have three menu items to show the level of play: Beginner, Intermediate, and Advanced. To implement a such a group, create one action message that they all use. This action message changes the appropriate setting, and then reflects that change by unchecking the currently checked item and checking the newly selected item.
In an action method that responds to all commands in the group use setState: to uncheck the menu item that is currently marked:
[curItem setState:NSOffState];
Then mark the newly selected command:
[sender setState:NSOnState];



However, when my menu item is selected, I just turn it's state on and do nothing else (for now).

Why is the state of the previously selected items being set to off?

Any idea?

Thank you.








_______________________________________________

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: Why does my menu have mutually exclusive states?
      • From: Peter Ammon <email@hidden>
  • Prev by Date: Re: How can I populate certain table-columns with image cells while using NSArrayController?
  • Next by Date: Re: Why does my menu have mutually exclusive states?
  • Previous by thread: Problem with NSView and enterFullScreenMode method.
  • Next by thread: Re: Why does my menu have mutually exclusive states?
  • Index(es):
    • Date
    • Thread