Re: NSTableColumn not usable with binder of class NSTextValueBinder?
Re: NSTableColumn not usable with binder of class NSTextValueBinder?
- Subject: Re: NSTableColumn not usable with binder of class NSTextValueBinder?
- From: "Ken Ferry" <email@hidden>
- Date: Wed, 20 Aug 2008 22:45:47 -0700
On Wed, Aug 20, 2008 at 10:33 PM, Dave Dribin <email@hidden> wrote:
> And for NSActionCell, we've got these:
>
> Exposed bindings: (
> editable,
> enabled,
> font,
> fontBold,
> fontFamilyName,
> fontItalic,
> fontName,
> fontSize,
> value
> )
>
> Indeed, NSActionCell has a "value" binding while NSCell does not.
Oh, huh. I thought I did that test too.
>> The information about how the bindings need to be hooked up may be
>> determined at design time in IB. If IB thinks you have a text cell,
>> you might get a binding set up in a way appropriate for a text cell.
>> In any case, this 'binder' thing should have a bug too, if you please.
>
> The NSTextValueBinder error message is a bug? Or the fact that NSCell does
> not have a "value" binding? Or both? ;)
Maybe both.. I meant the first.
Bindings are a little bit odd, in that they overload a name like
'value' to do rather different things. NSTextView has a value
binding, for example, that has no relation to the value binding on
NSTextFieldCell. You could say that both are 'values', but it's
unlikely that much code would be able to deal generically with both.
There's no property corresponding to 'value', it's defined specially
for each object that has the binding. I personally don't know why it
couldn't just correspond to objectValue for NSCell, but I might not
know the details.
>> If you want to go the bindings route, you could implement a value
>> binding on your cell subclass by overriding -bind:toObject:
>> withKeyPath:options: and then bind at runtime. That'd probably do the
>> trick.
>
> I tried this, and it does not work. In fact
> -bind:toObject:withKeyPath:options: never gets called in my NSCell subclass.
> I even called [self exposeBinding:@"value"] in +initialize, and
> bind:toObject:... still does not get called. Is this a different bug? It
> seems like I should be able to add bindings to an NSCell subclass in this
> way.
I meant that you should call bind:toObject:withKeyPath:options:
yourself rather than relying on IB to do it.
Like I said (or meant to say), I suspect the problem is that IB is
_not_ going through bind:toObject:withKeyPath:options: at nib loading
time, but rather setting up some objects that it determined at design
time in IB.
> In any case, I'm back to subclassing NSActionCell as the way to get this
> working.
Sounds like a plan.
-Ken
_______________________________________________
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