• 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: NSButtonCell visibility binding in NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButtonCell visibility binding in NSOutlineView


  • Subject: Re: NSButtonCell visibility binding in NSOutlineView
  • From: Kyle Sluder <email@hidden>
  • Date: Wed, 29 Apr 2009 03:04:27 -0400

On Tue, Apr 28, 2009 at 1:12 PM, Chris Tracewell <email@hidden> wrote:
> I am looking for the best method of turning off the visibility of an
> NSButtonCell object for individual rows in an OutlineView/TableView. I have
> an OutlineView that is bound to a TreeController. There are two columns. In
> the last column I am using a checkbox cell that should only be visible to
> the user when a representedObject in the TreeController has a certain
> property value. There is no Visibility binding only Enabled which does not
> hide the control but just dims it.

Hm.  I'm conflicted as to whether or not from a usability standpoint
you should prefer to display a disabled cell or none at all.

NSTableView has a -tableView:dataCellForTableColumn:row: delegate
method, so you don't need to subclass NSTableColumn.  Perhaps the
better approach is to subclass NSButtonCell and implement
-drawWithFrame:inView: somewhat like this:

-(void)drawWithFrame:(NSRect)frame inView:(NSView *)view {
  if([self shouldDisplayCheckboxForObject:[self objectValue]])
    [super drawWithFrame:frame inView:view];
}

Then, of course, you need to implement
-shouldDisplayCheckboxForObject, set an instance of this cell as the
cell for your table column, and bind the column to your model objects
instead of an attribute thereof.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSButtonCell visibility binding in NSOutlineView [SOLVED]
      • From: Chris Tracewell <email@hidden>
References: 
 >NSButtonCell visibility binding in NSOutlineView (From: Chris Tracewell <email@hidden>)

  • Prev by Date: Re: C string constant->NSString constant without defining twice?
  • Next by Date: Re: iphone SDK session duration
  • Previous by thread: NSButtonCell visibility binding in NSOutlineView
  • Next by thread: Re: NSButtonCell visibility binding in NSOutlineView [SOLVED]
  • Index(es):
    • Date
    • Thread