NSTableView and check boxes (for the hundredth time)
NSTableView and check boxes (for the hundredth time)
- Subject: NSTableView and check boxes (for the hundredth time)
- From: Jan Van Tol <email@hidden>
- Date: Wed, 2 Oct 2002 19:50:40 -0500
I know this has been discussed MANY times before on this list, but I've
read the archives relating to this, and it still won't work. When I
run this, I just get a column of zeros instead of checkboxes. What am
I doing wrong? Here is the code I'm trying to use:
- (void)awakeFromNib {
NSTableColumn *checkboxColumn;
checkboxColumn=[tableView tableColumnWithIdentifier:@"status"];
if (checkboxColumn)
{
NSButtonCell *protoCell;
protoCell=[[NSButtonCell alloc] init];
[protoCell setButtonType:NSSwitchButton];
[protoCell setImagePosition:NSImageOnly];
[protoCell setTitle:@""];
[checkboxColumn setDataCell:protoCell];
}
[tableView setHeaderView:nil];
[tableView setAction:@selector(clicked:)];
[tableView setTarget:self];
[tableView reloadData];
}
...
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
NSString *identifier = [aTableColumn identifier];
if ([identifier isEqualToString:@"myOtherColumn"]) {
//return stuff for my other column here...
}
if ([identifier isEqualToString:@"status"]) {
return [NSNumber numberWithBool: NO];
}
return nil;
}
The code is from OpenUp. Thanks in advance for any help.
-Jan Van Tol
_______________________________________________
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.