Ah, thank you. I knew I must have been missing something obvious.

On Jan 15, 2010, at 2:50 PM, Peter Ammon wrote:

> 
> On Jan 15, 2010, at 11:41 AM, Eric Gorr wrote:
> 
>> 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?
> 
> Hi Eric,
> 
> Your menu is in an NSPopUpButtonCell, and by default popups set the state of 
> the selected item, and clear the state of other items.  You can disable this 
> behavior by calling [cell setAltersStateOfSelectedItem:NO] on the popup 
> button cell.
> 
> -Peter
> 
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to