• 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
NSMenu bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMenu bug


  • Subject: NSMenu bug
  • From: Steve Gehrman <email@hidden>
  • Date: Mon, 10 Feb 2003 05:57:40 -0800

if I try to clear a menu item key equivalent like this....

[menuItem setKeyEquivalent:@""];
[menuItem setKeyEquivalentModifierMask:0];

The NSMenu that owns this menuItem does not sync correctly, it still
shows the old value.

The only way around this problem is to remove the menuItem and add it
back to the menu, this forces the menu to sync up with it's menu items

[menuItem retain];
{
NSMenu* menu = [menuItem menu];
int index = [menu indexOfItem:menuItem];
[menu removeItemAtIndex:index];

[menuItem setKeyEquivalent:[self key]];
[menuItem setKeyEquivalentModifierMask:[self modifiers]];

[menu insertItem:menuItem atIndex:index];
}
[menuItem release];

Anyone know a better way of solving this problem? Is this a known bug?

-steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSMenu bug
      • From: j o a r <email@hidden>
  • Prev by Date: Splash Screen Strategy?
  • Next by Date: Re: NSMenu bug
  • Previous by thread: Re: Splash Screen Strategy?
  • Next by thread: Re: NSMenu bug
  • Index(es):
    • Date
    • Thread