Re: Custom NSButtonCell and NSTableColumn binding
Re: Custom NSButtonCell and NSTableColumn binding
- Subject: Re: Custom NSButtonCell and NSTableColumn binding
- From: Alexander Lamb <email@hidden>
- Date: Sat, 19 Aug 2006 08:06:51 +0200
Well, I did read about alternative ways of achieving what I wanted to
do. But I feel the Bindings way is the way to go (maybe initially
difficult to setup but more logical in the long run).
So, yes I understand I need to implement the complete bindings stuff
in the custom control (as in mmalc's example).
However, mmalc's example shows a control and a cell. I need a
NSTableColumn and a cell... I didn't seem to see any example where
the NSTableColumn is setting something other than "value". Which
seems to indicate I will need to subclass my NSTableColumn and
implement the low level binding stuff in that subclass, more or less
the same way it is implemented in the control of mmalc's example...
and that's where I have a problem: I would like an example :-)
Alex
--
Alexander Lamb
email@hidden
On Aug 19, 2006, at 12:16 AM, Corbin Dunn wrote:
Alternately, you could override -setObjectValue: in your
NSButtonCell subclass to do your setup for you. In your modal
data, return an array containing the state and the color, then in -
setObjectValue: do something like this: (Note, typed in Mail, not
tested)
- (void)setObjectValue:(id <NSCopying>)aValue
{
if ( [aValue isKindOfClass:[NSArray class]] ) {
[super setObjectValue:[aValue objectAtIndex:0]]; //the state
[self setCheckColor:[aValue objectAtIndex:1]]; //your color
} else {
[super setObjectValue:aValue];
}
For various reasons, I actually don't recommend this, since it
means what is set with setObjectValue: won't be the same thing that
is returned from objectValue. For example, you set the object value
to an array, but calling objectValue then gives back a string (or
something), which is very strange.
--corbin
_______________________________________________
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