Removing / inserting Menuitems in Mainmenu
Removing / inserting Menuitems in Mainmenu
- Subject: Removing / inserting Menuitems in Mainmenu
- From: Stefan Heukamp <email@hidden>
- Date: Sat, 17 Feb 2007 15:31:50 +0100
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:
This email sent to email@hidden