Re: adding a sub menu to multiple super menus?
Re: adding a sub menu to multiple super menus?
- Subject: Re: adding a sub menu to multiple super menus?
- From: Graham Cox <email@hidden>
- Date: Thu, 6 Aug 2009 15:08:05 +1000
On 06/08/2009, at 5:41 AM, David M. Cotter wrote:
in carbon, you can have a sub menu that is used in more than one
super menu.
is there a trick to get this to go in Cocoa? otherwise i'm stuck
with cloning and managing all the clones (eg: if i enable a menu
item, or if i change the key shortcut, or change the item text, i
have to find all the clones and perform the same op on them too,
it's a real pain)
As far as I know a menu has to be a distinct instance - you can't
share them. I think I tried it once and it failed miserably.
However, the second part of your statement suggests that you are not
managing your menus in the most efficient way. There's no need to go
through all your menus and set them up in a particular way - just wait
for the menu to be used and then validate it. It doesn't matter which
menu is being validated, you just look at the individual item and set
it up on the fly. This is done using the NSMenuValidation protocol,
and its sole method, -validateMenuItem: Normally this is done to
enable and check/uncheck a menu item but it is also free to change the
title, key equivalent, etc. usually the only thing that needs to
remain constant is the item's action, which is its "identity" in the
sense that that's what the menu item does.
--Graham
_______________________________________________
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