menuNeedsUpdate for key equivalents?
menuNeedsUpdate for key equivalents?
- Subject: menuNeedsUpdate for key equivalents?
- From: Jim Prouty <email@hidden>
- Date: Thu, 13 Mar 2014 13:19:19 -0700
Our app allows the user to write programs and to create custom menus and menu items, including setting key equivalents.
Because the key equivalents are under user control and because we re-use some for multiple purposes, menu items' key equivalents change a lot.
We need to get a chance to update/modify the menus and key equivalents *before* Cocoa starts looking for menu items that match the key equivalent.
At that time we need the ability to add/remove menus and menu items, set key equivalents, and enable/disable menu items.
menuNeedsUpdate: is an NSMenuDelegate Procotol that allows us to do exactly that when the user clicks in the menubar.
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSMenuDelegate_Protocol/Reference/Reference.html
We'd love to have menuNeedsUpdate: be called before Cocoa starts calling menuHasKeyEquivalent:forEvent:target:action:.
menuDidOpen: is too late, according to the docs:
"Special Considerations: Don’t modify the structure of the menu or the menu items during this method."
Is there any way with OS X 10.6 and later to get this kind of advanced opportunity to modify menus and items for key presses?
Maybe some other class's delegate?
(Some our customers have 20 years worth of documents/programs which make rely on this feature, which Carbon's MenuSelect provides to this day.
That is, MenuSelect allowed us to rebuild the menus for both key events and menu bar events.)
--Jim
========================================================================
Jim "How does it work?" Prouty
Voice: (503) 620-3001, FAX: (503) 620-6754
Makers of IGOR Pro, scientific data analysis and graphing for Mac and PC
http://www.wavemetrics.com
_______________________________________________
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