Re: Binding values in a preferences window for live updates
Re: Binding values in a preferences window for live updates
- Subject: Re: Binding values in a preferences window for live updates
- From: Gordon Apple <email@hidden>
- Date: Thu, 13 Dec 2007 10:45:18 -0600
If you are using computed properties in your model, one thing you want
to do is register dependent keys for such properties. Otherwise, changing
something like a bound popup will not show up in dependents until something
(like a window activation event) forces a redraw. (I just faced this issue
myself yesterday.) In your model code, for each computed property add a
dependency statement similar to the following ("midColorHidden" is the
computed property):
+ (void)initialize {
[self setKeys:[NSArray arrayWithObject:@"fillMode"]
triggerChangeNotificationsForDependentKey:@"midColorHidden"];
or
[self setKeys:[NSArray arrayWithObjects:@"fillMode", @"checkBox", nil]
triggerChangeNotificationsForDependentKey:@"midColorHidden"];
etc.
}
>
> I want to calculate a value based on the values and/or indexes of
> NSPopUpButtons (and checkbox states) in a Preferences Window, then
> NSTextField-that back into the same window. The value should appear on
> awakeFromNib and refresh upon any change in selection - a recalculate
> button would suck.
>
> I seem to be stuck in an infinite loop with a screenful of documentation
> and webpages (plus Hillegass's book) trying to figure out what is
> relevant in the NSPopUp Inspector's bindings page, and then figure out
> how the calculation method is triggered and fed. A kick-start would be
> appreciated.
>
>
> vonhinx
> -------------------------
> be kind to newbies -`^ ^ ยด-
>
_______________________________________________
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