Re: NSButtonCell visibility binding in NSOutlineView [SOLVED]
Re: NSButtonCell visibility binding in NSOutlineView [SOLVED]
- Subject: Re: NSButtonCell visibility binding in NSOutlineView [SOLVED]
- From: Corbin Dunn <email@hidden>
- Date: Wed, 29 Apr 2009 10:47:35 -0700
On Apr 29, 2009, at 9:31 AM, Chris Tracewell wrote:
Kyle,
Thanks for the reply. Yes I know and agree on the issue of the
usability. I struggled with this but ultimately felt it was
essential as other options disassociated the property from the
object too much or made it appear that a given object could indeed
have the property enabled.
What I made work, and feels like the best solution is to use was a
OV delegate I had missed. It's nice as it requires no custom drawing
and allows me to inspect the object. It took one IBOutlet to bind to
the column I wanted to modify.
-(NSCell *)outlineView:(NSOutlineView *)outlineView
dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
if (tableColumn == myAttributeColumn && ![[[[item
representedObject] representedObject] myType]
isEqualToString:@"style"])
{
return [NSTextFieldCell new];
}
return [tableColumn dataCellForRow:item];
}
This is not a fully correct solution. Your code as-is will leak lots
of memory (unless you are creating a GC app, in which case it won't
have good performance due to creating too many cells). You probably
want to use -willDisplayCell to reset or properly setup your state for
the cells.
-corbin
_______________________________________________
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