Re: Making NSCell invisible in an NSOutlineView
Re: Making NSCell invisible in an NSOutlineView
- Subject: Re: Making NSCell invisible in an NSOutlineView
- From: Frank Midgley <email@hidden>
- Date: Fri, 8 Apr 2005 11:50:59 -0500
On Apr 6, 2005, at 6:16PM, Sunil Vemuri wrote:
I'm looking to make an NSCell in a column of an NSOutlineView
invisible depending upon the row/node. The checkbox is simply not
relevant to certain rows/nodes. Below is how I instantiate the
checkbox and how I *disable* the checkbox on a per-row basis. I would
prefer that nothing be shown instead of a disabled checkbox.
<snip>
I understand the issue of making a control invisible has been
discussed and I have read through the related threads that I could
find (cited below; apologies if I missed some other relevant thread).
However, I did not see this particular issue (an NSCell in an
NSOutlineView or NSTableView) covered. Is there a mechanism to make
the NSCell invisible or selectively display a different cell based on
the row?
Make an NSTableColumn sub-class and override -dataCellForRow: to return
a different cell for the rows that shouldn't show the checkbox.
Something like:
- (id)dataCellForRow:(int)row
{
BOOL showCell = [[[self tableView] dataSource]
shouldShowCellForRow:row];
if (showCell)
return [self dataCell];
else
return [[[NSCell alloc] initTextCell:@""] autorelease];
}
-Frank
------------------------------------
Frank M. Midgley
email@hidden
http://homepage.mac.com/knarf/
_______________________________________________
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