NSMenu menu items on the fly problem
NSMenu menu items on the fly problem
- Subject: NSMenu menu items on the fly problem
- From: Luc Vandal <email@hidden>
- Date: Thu, 14 Jul 2005 16:40:23 -0400
Hi!
I have a sub menu (from the main menu) that has items that are
added/removed on the fly. The first time I add items everything seems
to work ok but the next time I try to do the same (by previously
getting rid of all items) the menu just hangs! Here's some code:
if( [menuNavEl hasSubmenu] )
{
NSMenu* subMenu = [menuNavEl submenu];
NSArray* aSubItems = [subMenu itemArray];
int nSubCount = [aSubItems count];
VR_NAV_ELEM_PARAM* pElements = NULL;
int nElCount = VRGetNavElemTable( &pElements );
if( pElements )
{
for(int i=0;i<nSubCount;i++)
{
[subMenu removeItemAtIndex:i];
}
for(int i=0;i<nElCount;i++)
{
NSMenuItem* menuItem = [[NSMenuItem alloc] init];
[menuItem setTag:pElements->nElemNb];
[menuItem setTitle:[NSString
stringWithCString:pElements->szLabel]];
[subMenu insertItem:menuItem atIndex:i];
pElements++;
}
}
}
Am I doing something wrong???
Luc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden