• 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
Re: NSMenu menu items on the fly problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMenu menu items on the fly problem


  • Subject: Re: NSMenu menu items on the fly problem
  • From: glenn andreas <email@hidden>
  • Date: Thu, 14 Jul 2005 16:46:21 -0500


On Jul 14, 2005, at 3:40 PM, Luc Vandal wrote:
Am I doing something wrong???

I'd see what is going on in the debugger, but at the very, the following has a problem:



                    for(int i=0;i<nSubCount;i++)
                    {
                        [subMenu removeItemAtIndex:i];
                    }


This should be [subMenu removeItemAtIndex: 0]

(since as you increase i, the number of items in the submenu are decremented, and eventually, i ends up greater than the number of items left in the submenu, which should raise an exception). The first time through, since there are no elements (or even if there was 1 element) it would work fine...




Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! Widgetarium | the quickest path to widgets

_______________________________________________
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


References: 
 >NSMenu menu items on the fly problem (From: Luc Vandal <email@hidden>)

  • Prev by Date: Cocoa class for queuing operations?
  • Next by Date: Re: Subclassing NSColorWell?
  • Previous by thread: NSMenu menu items on the fly problem
  • Next by thread: Setting Transient Values
  • Index(es):
    • Date
    • Thread