Binding to currently selected object in a list?
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