Re: Removing submenus from a menu
Re: Removing submenus from a menu
- Subject: Re: Removing submenus from a menu
- From: j o a r <email@hidden>
- Date: Sun, 12 Jan 2003 17:21:26 +0100
Whay does it crash, ie. what is the reason listed in the crash log or
the debugger? At least the first and second option you list below is
correct in theory, and something I myself use in shipping applications
- the problem would have to be something else. Some suggestions:
* Have you verified that the index is within the bounds of the item
array?
* Have you verified that the item obtained is existing?
* Show us more code
* Try to reproduce the problem in a small sample app. If you can
reproduce it, send the sample project to me and I'll take a look.
I suspect that you have a retain count problem, or a stale pointer
somewhere. Try to trap the crash in the debugger and see where it
occurs!
j o a r
On Sunday, Jan 12, 2003, at 16:59 Europe/Stockholm, Greg Hurrell wrote:
I'm grappling with NSMenus for the first time and I know how to add
and remove basic items fairly easily. I also know how to add submenus
(create the NSMenuItem that will contain the submenu, make the NSMenu
that will be the submenu itself, set the submenu to be a submenu of
the item, then insert your item into the menu).
But how do I remove them? Everything I try ends up crashing the app.
I've tried the following, among other things:
// using an integer index for the NSMenuItem that I wish to remove
[theMenu removeItemAtIndex:theIndex];
and:
// using an id pointer to the NSMenuItem object I wish to remove
[theMenu removeItem:objectToRemove];
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.