• 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 tableColumn empty?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView tableColumn empty?


  • Subject: NSTableView tableColumn empty?
  • From: Mark Dawson <email@hidden>
  • Date: Thu, 23 Jun 2005 18:55:49 -0700

I've added an NSTableView in IB, with 2 columns. I've typed in column titles (and they show up). However, I think I misunderstand how to use -tableView:tableViewobjectValueForTableColumn: row: What I'm trying to do is figure out which column I'm being called to to return objects for (one column will be radio buttons, the other text). However, the code that I've seen to figure out what the column is doesn't work for me:

- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row
{
NSString *columnName = [tableColumn identifier];
if ([columnName isEqualToString:@"Active"])
{ // handle radio button info
return [self isActiveRow:row inTable:tableView];
}
else // handle text info
{
columnName = [dataSource nameForRow:row];
return columnName; // nothing matched
}
}

What I've discovered is that tableColumn's identifier is nil. So my test always fails. Maybe I've misunderstood how things work?

In my awakeFromNib file, I've used code that I've understood (maybe my mistake is here) "turns" the 1st column into radio buttons:

// turn the first column into radio buttons
NSButtonCell *radioButtonCell =
[[[NSButtonCell alloc] initTextCell:@""] autorelease];

[radioButtonCell setButtonType:NSRadioButton];
[[myNSTableView
tableColumnWithIdentifier:@:"Active"]
setDataCell:radioButtonCell];

Thanks for any insight!

Mark
 _______________________________________________
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 tableColumn empty?
      • From: Tony Cate <email@hidden>
  • Prev by Date: Why isn't my app showing up in launched applications
  • Next by Date: Re: Update menu
  • Previous by thread: Re: Why isn't my app showing up in launched applications
  • Next by thread: Re: NSTableView tableColumn empty?
  • Index(es):
    • Date
    • Thread