• 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
Setting NSPopUpButtonCell Value from NSTable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting NSPopUpButtonCell Value from NSTable


  • Subject: Setting NSPopUpButtonCell Value from NSTable
  • From: "Alexander F. Hartner" <email@hidden>
  • Date: Wed, 30 Jun 2004 21:45:45 +0200

I have configured a columnn containing NSPopUpButtons inside and
NSTable. I created a datasource and associated it my my table view. In
my DataSource I have added the following code:

- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
NSMutableArray * titles = [NSMutableArray arrayWithCapacity:3];
[titles addObject:@"Mr"];
[titles addObject:@"Ms"];
[titles addObject:@"Mrs"];
[titles addObject:[[NSNumber numberWithInt:rowIndex]stringValue]];
NSLog([aTableColumn identifier]);

if ([[aTableColumn identifier] isEqualToString:@"Labels"])
{
return titles;
}
return titles;
}


For the default type of cell returning a String is fine, but how can I
set individual values for each row using a NSPopUpButtonCell. Returning
a NSString array does not work. Is it possible to use this mechanism at
all. I understand that the instance of the cell class is shared for all
cells in the same column and that the value is provided from the
datasource, but what value do I need to return for a NSPopUpButtonCell.

If this is not the right way of doing it, do i need to subclass
NSTableColumn and implement the dataCellForRow method ?This seems quite
a bit of effort for just setting the values ?

Thanks
Alex
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Setting NSPopUpButtonCell Value from NSTable
      • From: Daniel Todd Currie <email@hidden>
  • Prev by Date: Java Cocoa question (NSImage overlays)
  • Next by Date: Context Menu disables clicks in NSQuickDrawView
  • Previous by thread: Re: Java Cocoa question (NSImage overlays)
  • Next by thread: Re: Setting NSPopUpButtonCell Value from NSTable
  • Index(es):
    • Date
    • Thread