Popup button
Popup button
- Subject: Popup button
- From: Carl Johan Foss <email@hidden>
- Date: Mon, 5 Feb 2007 17:44:06 +0100
Hi,
I have a popup button which I want to populate with some values. I
link it through bindings and set the Model Key Path to
"semesterLabels" which looks like this:
-(NSMutableArray *)semesterLabels
{
//return [NSArray arrayWithObjects:@"Test1", @"Test2", @"Test3", nil];
return [NSArray arrayWithArray:[arrayResult valueForKey:@"semester"]];
}
It all works fine when I return the first line which is commented out
now but when I return the second one it does not work. I believe the
reason is that when I print the different arrays the first one are
printed like this.
2007-02-05 17:40:45.616 ScheduleX[945] Result from mySQL: ("Fall
2006", "Spring 2007")
2007-02-05 17:40:45.616 ScheduleX[945] Result: (Test1, Test2, Test3)
Comes from this:
-(void)awakeFromNib
{
SQLConnection = [MCPConnection alloc];
SQLConnection = [SQLConnection initToHost:@"localhost"
withLogin:@"pref" password:@"pref" usingPort:3306];
[SQLConnection selectDB:@"myDB"];
queryResult = [[SQLConnection retain] queryString:@"SELECT * from
ws_dates"];
arrayResult = [[NSMutableArray alloc] initWithArray:[[self
fetchResultAsArray:queryResult] retain]];
NSLog(@"Result from mySQL: %@", [NSArray arrayWithArray:[arrayResult
valueForKey:@"semester"]]);
NSLog(@"Result: %@", [NSArray arrayWithObjects:@"Test1", @"Test2",
@"Test3", nil]);
}
As you can see Test1, Test2, Test3 is printed without the "".
Any ideas if this is the reason why my NSPopupButton is not populated
when I want to print my semester labels from the database?
Thanks in advance.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden