• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Checkboxes in Table Views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Checkboxes in Table Views
      • From: James Housley <email@hidden>
References: 
 >Checkboxes in Table Views (From: Steve Woodward <email@hidden>)
 >Re: Checkboxes in Table Views (From: James Housley <email@hidden>)

  • Prev by Date: Re: Custom Objects in an NSTextView
  • Next by Date: **JOB LISTING**
  • Previous by thread: Re: Checkboxes in Table Views
  • Next by thread: Re: Checkboxes in Table Views
  • Index(es):
    • Date
    • Thread