• 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: Creating Menu Items from NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating Menu Items from NSMutableArray


  • Subject: Re: Creating Menu Items from NSMutableArray
  • From: Kyle Moffett <email@hidden>
  • Date: Fri, 16 Aug 2002 18:49:31 -0400

On Friday, August 16, 2002, at 05:16 PM, Ryan Hale wrote:
Well, the code seems to work, and I added in my outlets and arrays where needed, but PB gives the following errors when compiling (the number on the left corresponds to the line number in the code below):

1) "parse error before 'int'"
2) "invalid lvalue in assignment"
2) "wrong type argument to increment"

Any ideas?


1 int index;
2 for (index = 0; index < [myArray count]; index++) {
3 NSMenuItem *newItem;
4 newItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]]
5 initWithTitle:[myArray objectAtIndex:index] action:NULL
6 keyEquivalent:@""];
7 [newItem setTarget:self];
8 [newItem setAction:@selector(myAction:)];
9 [myMenu addItem:newItem];
10 [newItem release];
11 }

A basic C error. The 'int index;' needs to come with all the other
variable declarations at the beginning of the function or block.

HTH,
Kyle Moffett
_______________________________________________
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.

  • Follow-Ups:
    • Re: Creating Menu Items from NSMutableArray
      • From: Andrew Pinski <email@hidden>
References: 
 >Re: Creating Menu Items from NSMutableArray (From: Ryan Hale <email@hidden>)

  • Prev by Date: Re: NSDocument:windowControllerDidLoadNib && When are outlets connected to te loaded nib?
  • Next by Date: Re: NSDocument:windowControllerDidLoadNib && When are outlets connected to te loaded nib?
  • Previous by thread: Re: Creating Menu Items from NSMutableArray
  • Next by thread: Re: Creating Menu Items from NSMutableArray
  • Index(es):
    • Date
    • Thread