Re: Checkboxes in Table Views
Re: Checkboxes in Table Views
- Subject: Re: Checkboxes in Table Views
- From: Corbin Dunn <email@hidden>
- Date: Wed, 4 Jan 2006 09:22:18 -0800
[prototypeCell setTarget:self];
[prototypeCell setAction:@selector(uploadFileCheckBox:)];
The action of your cell is set -- no problem.
[[enclosureTable tableColumnWithIdentifier:@"UploadCheckBox"]
setDataCell:prototypeCell];
Then I have this module
- (void)uploadFileCheckBox:(id)sender
{
int oldValue = ![[[itemsWithEnclosuresCheckbox objectAtIndex:
[enclosureTable selectedRow]] objectAtIndex:0] intValue];
[[itemsWithEnclosuresCheckbox objectAtIndex:[enclosureTable
selectedRow]] replaceObjectAtIndex:0 withObject:[NSNumber
numberWithInt:oldValue]];
}
Okay -- there is a small problem with this bit of code. TableView
(arguably) has the side effect of selecting a row when you click on a
checkbox. Currently, this makes your code work correctly. However, if
one allows multiple selection on the tableview, then a shift-click or
cmd-click could cause [enclosureTable selectedRow] to be something
different. I highly recommend using [enclosureTable clickedRow] for
cases like this. Just FYI. Thanks!
--corbin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden