• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Basic bindings questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Basic bindings questions (From: Steve Weller <email@hidden>)
 >Re: Basic bindings questions (From: "John C. Randolph" <email@hidden>)
 >Re: Basic bindings questions (From: Steve Weller <email@hidden>)

  • Prev by Date: Re: NSMenuItem attributed title size discrepancy
  • Next by Date: Re: NSMenuItem attributed title size discrepancy
  • Previous by thread: Re: Basic bindings questions
  • Next by thread: Re: Basic bindings questions
  • Index(es):
    • Date
    • Thread