• 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
Binding to currently selected object in a list?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding to currently selected object in a list?


  • Subject: Binding to currently selected object in a list?
  • From: A B <email@hidden>
  • Date: Fri, 09 Oct 2009 15:08:16 -0700

Is there a way to bind an ivar to the currently selected object of a list which is being represented in an NSTableView via bindings?  Unfortunately there does not seem to be a "selectedObject" key (though there is one for "selectedObjects").  Binding to the controller's "selection" doesn't really work as I'd expect and even if it did, I'd only be getting back a proxy object - which negates the purpose for which I want to use it, which is to call methods on the object.  I had put in a hack which observes changes in selection, gets the selectedObjects list, checks for a count > 0, grabs the first and stuffs it into the ivar, etc. but not only does that feel really hackish, but doesn't always work.

This would seem to be a pretty simple thing to want to do (i.e. present a list of objects, do things to/with the currently selected object) but I'm at somewhat of a loss to understand what I'm doing wrong.
_______________________________________________

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: Binding to currently selected object in a list?
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Detecting if application is running as Finder
  • Next by Date: Binding to values which aren't there
  • Previous by thread: Re: Detecting if application is running as Finder
  • Next by thread: Re: Binding to currently selected object in a list?
  • Index(es):
    • Date
    • Thread