Multiple cells in table column
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.