Re: Scared by implicit use of 'description' in bindings
Re: Scared by implicit use of 'description' in bindings
- Subject: Re: Scared by implicit use of 'description' in bindings
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 4 Apr 2006 12:31:14 -0700
On 4/4/06, Matt Gough <email@hidden> wrote:
>
> On 4 Apr 2006, at 17:18, Paul Lynch wrote:
>
> >> As my code evolved I needed to change the underlying objects being
> >> controlled by the array controller to my own object type. In order
> >> to get my buttons to display correctly I found that I needed to
> >> write a -(NSString*) description method in my class. This also
> >> worked great, but I was a little apprehensive at the time as up
> >> until then I had only really used description for debugging
> >> purposes. Also, at no point in my bindings setup do I ever
> >> explicitly set 'description' as the Model Key path. However, I
> >> left it alone and carried on with more important things.
> >
> > At some point you bound something (presumably your button title) to
> > the object itself (selectedObject, or whatever). It will call the
> > description method to 'coerce' it to a string - this is what you
> > have missed. Change that binding to your buttonTitle method.
> >
> Alas, AFAIK there is no such binding hiding out anywhere.
A "title" binding exist for buttons however it looks like it expects
an NSString. Set the model path to bind it to what you want it to use
to get the title.
<http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSButton.html>
-Shawn
_______________________________________________
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