• 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: Drag and drop in NSOutlineView connected to a NSTreeController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag and drop in NSOutlineView connected to a NSTreeController


  • Subject: Re: Drag and drop in NSOutlineView connected to a NSTreeController
  • From: "I. Savant" <email@hidden>
  • Date: Tue, 14 Mar 2006 08:46:51 -0500


I feel ya, I really do. However, some good points from the article:

"In Tiger, using NSTreeController with NSOutlineView means drag-and- drop doesn't work as expected. This definitely does not mean you should abandon bindings, especially if you're using Core Data."

  ...and...

"When using NSTreeController, the "item" objects handed to you in the drag-and-drop datasource methods are actually instances of the private _NSArrayControllerTreeNode class. There's no real way to communicate with them directly."

Seems this truly is the best way to approach the problem currently. That is *if* you're using NSTreeController. I ended up abandoning this approach myself because I did have some very specific needs that still weren't addressed by this article and I was also a bit concerned about the private API usage. I went the datasource way with my own custom controller class.

Also, I realize in retrospect my response may have sounded condescending - and it was, a little. :-) If your problem is that you don't want to use private API, again, I sympathize. However, if you want to use NSTreeController, this seems like the best (only?) approach. IIRC, this has been discussed on this list a few times before and I'm speaking entirely from memory on this issue. Your mileage may vary.

--
I.S.


On Mar 14, 2006, at 8:37 AM, Darren Ford wrote:

Yup, found that one.

But it is a hack using a private API. It seems too inelegant for Cocoa, given that the rest of the bindings stuff is quite elegant. Having to set up a false NSOutlineViewDataSource and returning dodgy values seems like a problem waiting to happen with the next 10.4.x release.

Also, it appears that with this method you have to manually insert/ remove the objects from the treecontroller yourself in the 'acceptDrop' call. Given that the NSTreeController 'controls' the objects it manages, having to write code to remove an object from one tree branch's NSArrayController and insert it into the other and then refresh the NSTreeController feels like I'm doing something wrong and completely unbindings-like.

Cheers -- Darren.



On 15/03/2006, at 12:20 AM, I. Savant wrote:


On Mar 14, 2006, at 7:21 AM, Darren Ford wrote:
I've been putting together a simple app to learn how to use NSTreeController to bind to an NSOutlineView. All's well with basic adding/removing etc. but I've been having a few problems getting drag and drop within the outlineview working. I've looked through the Apple doco and on Google but haven't had any luck.


Really? When I google "nstreecontroller drag and drop", the very first result is a beautifully-written tutorial on the subject:

http://theocacao.com/document.page/130

Are you taking a different approach that makes this article unusable to you? If so, you'll probably need to specify.

--
I.S.




_______________________________________________ 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
  • Follow-Ups:
    • Re: Drag and drop in NSOutlineView connected to a NSTreeController
      • From: Keith Wilson <email@hidden>
References: 
 >Drag and drop in NSOutlineView connected to a NSTreeController (From: Darren Ford <email@hidden>)
 >Re: Drag and drop in NSOutlineView connected to a NSTreeController (From: "I. Savant" <email@hidden>)
 >Re: Drag and drop in NSOutlineView connected to a NSTreeController (From: Darren Ford <email@hidden>)

  • Prev by Date: Re: Drag and drop in NSOutlineView connected to a NSTreeController
  • Next by Date: Help in grouping set of objects
  • Previous by thread: Re: Drag and drop in NSOutlineView connected to a NSTreeController
  • Next by thread: Re: Drag and drop in NSOutlineView connected to a NSTreeController
  • Index(es):
    • Date
    • Thread