• 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
Multiple cells in table column
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiple cells in table column


  • Subject: Multiple cells in table column
  • From: Ramesh PVK <email@hidden>
  • Date: Tue, 27 Jan 2004 11:21:44 +0530

I need to present a column with cells which can be checkboxes, combo
boxes, text fields, etc depending on the rows which is being
displayed/edited. Is there a simple way to do this?
(or a way to do this at all, without rewriting the whole NSTableView).

You need to subclass NSTableColumn and override the
dataCellForRow:(int)rowIndex function. In this function you need to
return the type of cell you need for the given row index.The following
code may give you an idea.
- (id)dataCellForRow:(int)row
{


switch(row)
{
case 0:
NSImageCell * cell =[[NSImageCell alloc] init];
[cell setBordered:YES];
return cell;
break;
case 1:
NSPopUpButtonCell *cell=[[NSPopUpButtonCell alloc] init];
[cell setBordered:YES];
return cell;
break;
case 2:
NSTextFieldCell * cell =[[NSTextFieldCell alloc] init];
[cell setBordered:YES];
return cell;
break;
case 3:
NSButtonCell * cell =[[NSButtonCell alloc] init];
[cell setBordered:YES];
return cell;
break;

}
}

--Ramesh
_______________________________________________
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: Multiple cells in table column
      • From: Scott Anguish <email@hidden>
  • Prev by Date: String in hexadecimal
  • Next by Date: Re: What's it called if it's not a controller?
  • Previous by thread: Re: String in hexadecimal
  • Next by thread: Re: Multiple cells in table column
  • Index(es):
    • Date
    • Thread