• 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
NSTableView again
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView again


  • Subject: NSTableView again
  • From: XTAL <email@hidden>
  • Date: Tue, 19 Oct 2004 14:55:22 +0200

hi all,

i know this topic is a bit trivial for the most of you, but i'm stuck at a certain point. the problem is the following:

i created a tableview, and provided a data source (which is an NSMutableArray). i added strings and checkboxes to the table with the following code:

NSTableColumn* tableCol = [tableView tableColumnWithIdentifier:@"checkCol"];
if(tableCol)
{
NSButtonCell *checkBox = [[[NSButtonCell alloc] initTextCell:@""] autorelease];
[checkBox setButtonType:NSSwitchButton];
[checkBox setControlSize:NSSmallControlSize];
[tableCol setDataCell:checkBox];
}

NSMutableDictionary *rowData = [NSMutableDictionary dictionary];
[rowData setObject:rowName forKey:@"stringCol"];
[tableData addObject:rowData];
[tableView reloadData];

(stringCol is the string column in the table, and checkCol is the checkbox column.) it's displayed OK, no problems so far. i can also retrieve the strings from the table using the following code:

NSDictionary *rowData = [tableData objectAtIndex:i];
NSString *cellName = [rowData objectForKey:@"stringCol"];

(tableData is the data source, an NSMutableArray.) however, i'm unable to get the state of the checkbox:

NSDictionary *rowData = [tableData objectAtIndex:i];
NSButtonCell *cellCheck = [rowData objectForKey:@"checkCol"];

i'm stuck at this point. how do i retrieve the state of the checkbox? i tried the following, but it doesn't work:

int checkState = [cellCheck state];

thanks in advance for your help,

xtal
_______________________________________________
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: NSTableView again
      • From: Andreas Hoeschler <email@hidden>
  • Prev by Date: Re: Obtaining the size of a directory
  • Next by Date: Re: NSTableView again
  • Previous by thread: clean fails
  • Next by thread: Re: NSTableView again
  • Index(es):
    • Date
    • Thread