Re: Rebuilding menus (menuNeedsUpdate:) and System Preferences keyboard shortcuts.
Re: Rebuilding menus (menuNeedsUpdate:) and System Preferences keyboard shortcuts.
- Subject: Re: Rebuilding menus (menuNeedsUpdate:) and System Preferences keyboard shortcuts.
- From: "I. Savant" <email@hidden>
- Date: Mon, 1 Dec 2008 16:36:32 -0500
> At first I thought the solution was obvious: I was building these menus as needed, in the NSMenu delegate method, -menuNeedsUpdate: This method only gets called when the user goes to look at the menu. So, if these dynamic menus were only built in -menuNeedsUpdate:, then clearly the keyboard shortcuts defined in System Preferences for any items in such menus would note work until after the user had opened the menu at least once (thus populating it in -menuNeedsUpdate: and allowing the defined shortcut actually to apply to something, because before this the menu wouldn't have existed).
I've noticed a bug where calling -[NSMenuItem setKeyEquivalent:]
does not update unless you first set it to @"" then to the target. I
don't believe I remembered to file this with Apple ...
--
I.S.
_______________________________________________
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