Re: Custom NSButtonCell and NSTableColumn binding
Re: Custom NSButtonCell and NSTableColumn binding
- Subject: Re: Custom NSButtonCell and NSTableColumn binding
- From: Matt Neuburg <email@hidden>
- Date: Fri, 18 Aug 2006 09:10:24 -0700
- Thread-topic: Custom NSButtonCell and NSTableColumn binding
On Fri, 18 Aug 2006 12:15:35 +0200, Alexander Lamb <email@hidden> said:
>Hello list,
>
>I searched the list and other sites. Many people seem to have the
>same question but none found the answer. So here it goes:
>
>I have a custome NSButtonCell: an LSColorCheckCell which in addition
>to having a state ,has a color (checkColor).
>
>I made the cell key-value-coding compliant by implementing the
>setCheckColor and checkColor accessor methods.
>
>I havn't made a palette yet but in IB I set my column of the
>NSTableView to a NSButtonCell then choose LSColorCheckCell as the
>custom cell class.
>
>after loading the nib, I programmatically set the binding between my
>controller and my NSTableColumn:
>
> [myTableColumn bind:@"checkColor" toObject:myController
>withKeyPath:@"arrangedObjects.color" options:nil];
>
>Unfortunately, I get the following runtime error:
>
>[Session started at 2006-08-18 12:08:55 +0200.]
>2006-08-18 12:09:01.443 PeopleTasks[18281] Exception raised during
>posting of notification. Ignored. exception:
>[<LSColorCheckTableColumn 0x360040> valueForUndefinedKey:]: this
>class is not key value coding-compliant for the key checkColor.
>2006-08-18 12:09:01.531 PeopleTasks[18281] *** NSRunLoop ignoring
>exception '[<LSColorCheckTableColumn 0x360040>
>valueForUndefinedKey:]: this class is not key value coding-compliant
>for the key checkColor.' that raised during posting of delayed
>perform with target 16252a0 and selector 'invokeWithTarget:'
>
>Now this seems logical since it is my cell which is key-value-coding
>for checkColor, not my table view. Do I need to create a subclass of
>NSTableView with setCheckColor? if so, what object do I forward the
>call since obviously it is not the table column keeping the color?
Do you understand how to write the back end for a full-fledged custom
binding? (mmalc's GraphicsBinding example shows you the sort of thing you
must be prepared to do.) If not, you might be happier setting the color in
some other way, e.g. thru tableView:willDisplayCell:.... m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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