On Jan 20, 2010, at 20:17, Andrew Shamel wrote:

> I have an NSOutlineView with its only column bound at 
> treeController.arrangedObjects.name to an NSTreeController that manages a 
> Core Data entity called Collection with the property "name."
> 
> The NSOutlineView's dataSource IBOutlet is connected to a custom class 
> CollectionViewController for the purposes of handling drag and drop.
> 
> What I would like to do is bind the NSOutlineView's selectionIndexPaths 
> binding to the NSTreeController's selectionIndexPaths key.  When I do this, 
> however, I get back this error:
> 
> Illegal NSOutlineView data source (<CollectionViewController: 0x1001722d0>).  
> Must implement outlineView:numberOfChildrenOfItem:, 
> outlineView:isItemExpandable:, outlineView:child:ofItem: and 
> outlineView:objectValueForTableColumn:byItem:
> 
> and there is nothing in the NSOutlineView (or any other bound views for that 
> matter).
> 
> I tried implementing "dummy" versions of those NSOutlineViewDataSource 
> methods (that return negative or nil values), as I have seen recommended in 
> the archives, but this also results in a host of empty views.
> 
> Have there been any developments on this front?  Is there any way to bind the 
> selectionIndexPaths binding while still using bindings for the 
> NSOutlineView's data?

Your problem is nothing to do with selectionIndexPaths, but rather how you're 
using the data source.

Table & outline views have a content binding, which is an alternative to using 
a data source. If you provide neither binding nor data source (which is the 
typical case), then the view figures it out from the bindings of the columns 
themselves.

In your case, you've explicitly specified a data source, so the column binding 
is *just* the column binding. You must fully implement the data source methods, 
and they have to return real data. The only shortcut you can take is that 
'outlineView:objectValueForTableColumn:byItem:' isn't actually going to be 
called -- since you only have one column, and *its* data is coming from its own 
binding.

Of course, if you've got to implement almost all of the data source anyway, 
then it might be easier to add the last piece and feed the column through the 
data source instead of a binding.


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to