Re: Checkboxes in Table Views
Re: Checkboxes in Table Views
- Subject: Re: Checkboxes in Table Views
- From: James Housley <email@hidden>
- Date: Wed, 4 Jan 2006 12:44:18 -0500
On Jan 4, 2006, at 12:22 PM, Corbin Dunn wrote:
[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
I Knew that wasn't quite right, but I don't allow multiple selections
on that table. I did not know about "clickedRow" and will look at
that and use it.
Jim
--
/"\ ASCII Ribbon Campaign .
\ / - NO HTML/RTF in e-mail .
X - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
email@hidden http://www.FreeBSD.org The Power to Serve
email@hidden http://www.TheHousleys.net
---------------------------------------------------------------------
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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