On Tue, Apr 28, 2009 at 1:12 PM, Chris Tracewell <ch...@thinkcl.com> 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com