• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSMenu menu items on the fly problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSMenu menu items on the fly problem
      • From: glenn andreas <email@hidden>
  • Prev by Date: Unique Values for Entity Attributes
  • Next by Date: Re: C++ thread messaging cocoa thread
  • Previous by thread: Unique Values for Entity Attributes
  • Next by thread: Re: NSMenu menu items on the fly problem
  • Index(es):
    • Date
    • Thread