Re: Removing / inserting Menuitems in Mainmenu
Re: Removing / inserting Menuitems in Mainmenu
- Subject: Re: Removing / inserting Menuitems in Mainmenu
- From: "Luis E. Garcia" <email@hidden>
- Date: Sun, 18 Feb 2007 09:32:58 -0600
Stefan,
Why not add all the menu items in to the main NIB and just disable
them when the appropriate window becomes the KeyWindow?? That would
take out a little clutter off your code and have the same result
functionality wise.
Regards,
Luis Garcia
On Feb 17, 2007, at 8:31 AM, Stefan Heukamp wrote:
Hi,
in my Application I have two Windows which have slightly different
MainMenues. This means each of them has 2 or 3 Menuitems which the
other one doesn't have.
At the moment I remove and insert those items in the window's
delegate's becomeKeyWindow and resignKeyWindow methods.
This is not very elegant and i get a lot of those loglines:
*** Assertion failure in -[NSMenu itemAtIndex:], Menus.subproj/
NSMenu.m:713
Invalid parameter not satisfying: (index >= 0) && (index <
(_itemArray ? CFArrayGetCount((CFArrayRef)_itemArray) : 0))
These loglines are printed when I use keyboard-shortcuts. When I
click the same Menuentries I do not get those errors.
The surprising thing is that there are no restrictions regarding
the functionality. The only thing is that I do not like those
loglines ;-)
What do these errors mean? Is it not possible to alter the mainmenu
via insertItem and removeItem? Do I have to call any update-
function after altering the mainmenu?
What would be the intended way to change the mainmenu the way I
described? I looked at the NSMenuValidation-Protocol but it only
grays out the not wanted menu items.
Should I build two Menues in the Interface Builder and only
exchange them?
Thanks for any answer in advance,
Stefan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40turbonett.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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