Re: Clearing NSTableView on unbind
Re: Clearing NSTableView on unbind
- Subject: Re: Clearing NSTableView on unbind
- From: Edwin Vane <email@hidden>
- Date: Mon, 22 Aug 2005 13:42:23 -0400
- Mail-followup-to: Cocoa-Dev <email@hidden>
Thanks for the suggestion. This solution prompts me to ask a question
about a problem I've just been avoiding.
If I use an NSObjectController as the intermediate controller, I can
keep the default object as NSMutableDictionary and insert any object I
want to bind to (or nil as you suggested). One of these objects will be
a class that implements the to-many relationship to bind the table's
array controllers to.
In Interface Builder, I can tell the array controller to bind to the
selection key of the intermediate controller and set the keypath to be
something like ToManyObj.keyName. This automatically adds
ToManyObj.keyName as a managed key to the object controller.
Now, when I insert a ToManyObj into the object controller's dictionary
programmatically, what key should I give it? ToManyObj or
ToManyObj.keyName? My past experiments seem to suggest neither work.
This seems a plausible thing to do (the same technique is/was used to
avoid the NSWindowController/binding bug) but perhaps there's something
about keypaths I'm not understanding.
Any ideas on how to make this work?
On Mon, Aug 22, 2005 at 11:53:00AM -0400, Jim Correia wrote:
> On Aug 22, 2005, at 11:42 AM, Edwin Vane wrote:
>
> >I'm trying to find a nice solution to a simple little problem. I
> >have a
> >window that serves as a kind of inspector of a selected object. The
> >inspector has a table view inside to list some of the properties of
> >the
> >selected object. When the selected object changes, I re-bind the array
> >controllers feeding data to the table to the new selected object.
> >However, when there
> >is no/multiple selection, I would like the table to be empty.
> >Unfortunately, just doing an unbind doesn't seem to work.
> >
> >Any suggestions?
>
> Use an intermediate controller for the inspector views, and set its
> content to nil when there are no inspect-able objects.
>
> Jim
>
--
Edwin Vane
MMath Candidate
Computer Graphics Lab
School of Computer Science
University of Waterloo
_______________________________________________
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