Re: Creating Menu Items from NSMutableArray
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.