Re: Binding NSPopupButton crashes
Re: Binding NSPopupButton crashes
- Subject: Re: Binding NSPopupButton crashes
- From: Matt Neuburg <email@hidden>
- Date: Mon, 15 Oct 2007 12:38:23 -0700
- Thread-topic: Binding NSPopupButton crashes
On Mon, 15 Oct 2007 11:17:19 -0700, Steve Checkoway <email@hidden> said:
>>> I am trying to bind an NSPopupButton to the user defaults in Interface
>>> Builder as well as programatically binding a property in another class
>>> to the same user default value.
You're trying to bind *what* about the NSPopupButton? Remember, lots of
things about a popup button are bindable; and three things about a popup
button are usually bound if you're going to bind any of them.
I suspect (though this is just a guess, because you have not given any
information) that what you are thinking of binding is the selectionIndexes
(i.e. you want user defaults to preserve a knowledge of what the user has
selected in the popup menu). But if that is all you are binding, then you
must do it after the popup button's menu is populated or you'll crash.
Furthermore, selectionIndexes is a set, whereas what you want to store in
user defaults is probably a number. It might be better to do this binding in
code, because then you can be in charge when the binding goes into effect,
and you can use a value transformer to mediate the between the set and the
number.
>
>Programatically, I have the following.
>
>NSUserDefaultsController *defaultsController = [NSUserDefaultsController
>sharedUserDefaultsController];
>
>[object bind:@"foo"
> toObject:defaultsController
> withKeyPath:@"values.foo"
> options:nil];
But that is completely uninformative, since we don't know what values.foo
is. What kind of value is it, and how are you binding from the popup button
to that value?
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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