• 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: Keys dependent on NSArrayController's selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keys dependent on NSArrayController's selection


  • Subject: Re: Keys dependent on NSArrayController's selection
  • From: Dave Dribin <email@hidden>
  • Date: Thu, 8 May 2008 13:45:20 -0500

On May 8, 2008, at 9:22 AM, Sean McBride wrote:
On 5/8/08 1:53 AM, Dave Dribin said:
For kicks, I did try
"peopleController.selectionIndex" as well as
"peopleController.selectedObjects" to no avail.

So it seems you have observed the same as I: that keyPathsForValuesAffectingValueForKey does not seem to work with key paths, despite the docs saying it should.

Yeah, I'm confused. I think this *should* work. Is it broken, or are the docs just not pointing out a known limitation?


This is what I was remembering:
<http://www.cocoabuilder.com/archive/message/cocoa/2006/6/4/164955>

That's pretty clear, and I'm understanding that I *shouldn't* do willChange/didChange. What I'm lacking is information of how to do it the "proper" way. If keyPathsForValuesAffectingValueForKey: is not effective, what are my options?


I guess another option is to not use bindings for the button's enabled state, and just do it the "old fashioned way" with an outlet to the button, along with manual KVO:

- (void)updateButtonEnabled {
    [button setEnabled: self.canEnableButton];
}

- (void) awakeFromNib {
    [peopleController addObserver:self
                       forKeyPath:@"selectionIndexes"
                          options:0
                          context:SelectionIndexesContext];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (context == SelectionIndexesContext)
[self updateButtonEnabled];
}


-Dave

_______________________________________________

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


  • Follow-Ups:
    • Re: Keys dependent on NSArrayController's selection
      • From: "Sean McBride" <email@hidden>
References: 
 >Keys dependent on NSArrayController's selection (From: Dave Dribin <email@hidden>)
 >Re: Keys dependent on NSArrayController's selection (From: "Sean McBride" <email@hidden>)
 >Re: Keys dependent on NSArrayController's selection (From: Dave Dribin <email@hidden>)
 >Re: Keys dependent on NSArrayController's selection (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: BLOBs, MySQL, hex. Oh my
  • Next by Date: Re: Keys dependent on NSArrayController's selection
  • Previous by thread: Re: Keys dependent on NSArrayController's selection
  • Next by thread: Re: Keys dependent on NSArrayController's selection
  • Index(es):
    • Date
    • Thread