• 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
Re: Making NSCell invisible in an NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Making NSCell invisible in an NSOutlineView (From: Sunil Vemuri <email@hidden>)

  • Prev by Date: Re: event/notification for focus?
  • Next by Date: Re: NSSplitView
  • Previous by thread: Re: Making NSCell invisible in an NSOutlineView
  • Next by thread: Hiding/Showing Column Of TableView
  • Index(es):
    • Date
    • Thread