Buttons in an NSTableView
Buttons in an NSTableView
- Subject: Buttons in an NSTableView
- From: justin <email@hidden>
- Date: Sat, 18 May 2002 15:21:55 -0500
I'm making an application with a table that is similar to the table in
iTunes. I want the user to be able to check on and off which items they
want to use from the table. My problem now is trying to get the
checkboxes in the tableview.
So i am putting buttons in a NSTableView. From what i can gather it
seems like i would use an NSButtonCell. This code, however, is not even
close to working.
// my awakeFromNib initializes id someButton;
- (void)awakeFromNib
{
someButton = [[NSButtonCell alloc] init];
[someButton setButtonType:NSSwitchButton];
[tableView reloadData];
}
// TableView either displays the regular text OR if column is "playing"
should display a button
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex;{
if ([[aTableColumn identifier] isEqualTo:@"playing"])
{
return someButton;
}
else
return [[[controller currentPlaylist] objectAtIndex:rowIndex]
objectForKey:[aTableColumn identifier]];
}
Like I said, this isn't working. It gives the string description of the
NSButtonCell. No button.
Do tableviews only display strings? How does the outline view in
prodject Builder, for instance, hold checkBoxes for Groups & Files? Am i
going about this the wrong way?
thanks for any help.
justin.
_______________________________________________
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.