programatically changing values on a bound NSSlider
programatically changing values on a bound NSSlider
- Subject: programatically changing values on a bound NSSlider
- From: Martin Redington <email@hidden>
- Date: Sun, 15 Oct 2006 04:12:02 +0100
I have a pair of NSSliders that are bound to SharedUserDefaults
One represents a maximum value, and one represents a minimum.
I would like to make sure that the value of the maximum slider is
always greater than the minimum.
As well as the bindings, the NSSlider's action points to a method
that checks the matched NSSlider. If the maximum >= minimum contraint
is violated, the action method call's
[otherSlider setDoubleValue:[self doubleValue]];
This works very nicely. When the maximum is dragged down to meet the
minimum, the minimum slider tracks with it, so that the constraint is
not violated, and when the minimum slider is dragged backup to meet
the maximum, the maximum slider starts tracking it.
However, calling setDoubleValue on the other slider does not seem to
update the corresponding bound value in the defaults. I'm not
entirely surprised by this. I'm hoping that there's some simple
bindings related method I can call to notify that the slider value
has changed, but I can't quite work out what it is.
How can I change the value of the other NSSlider programmatically,
and have the binding pick it up? I tried playing with
didChangeValueForKey:, but that didn't seem to do it for me.
I could presumably just change the value on the defaults, and the
otherSlider would pick that up, but I'd rather avoid that if possible.
_______________________________________________
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