Re: Basic bindings questions
Re: Basic bindings questions
- Subject: Re: Basic bindings questions
- From: mmalcolm crawford <email@hidden>
- Date: Tue, 12 Jul 2005 21:17:18 -0700
On Jul 12, 2005, at 8:51 PM, Steve Weller wrote:
2. I added a NSButton to the window and added a method clicked:
that doubles the value of sliderValue. I bound the button to the
Object controller with selection.clicked and sure enough my
clicked method is called and sliderValue is doubled each time I
click it. However the text field does not change when the button
is clicked. How do I get the text field to update when
sliderValue is changed programatically?
see -willChangeValueForKey: and -didChangeValueForKey:
It works now, thanks to that clue.
I had these in my code *and* in the right place, but it was
Objective-C that tripped me up. Instead of
[self willChangeValueForKey:@"sliderValue"];
sliderValue = newvalue;
[self didChangeValueForKey:@"sliderValue" ];
Where are you implementing this? Typically you should be using
automatic KVO notifications (via accessor methods) and there should
generally be little reason for you to need to call these methods
directly.
mmalc
_______________________________________________
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