• 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: Darren Ford <email@hidden>
  • Date: Wed, 15 Mar 2006 09:44:12 +1100

Ok, I think you guys have made up my mind for me :-) I have an existing App that uses an NSTableView/NSArrayController for managing items which I was hoping to change to an NSOutlineView/ NSTreeController to allow hierarchical data, but I think that I'll wait until it gets updated with trying to convert it across. I rely kinda heavily on bindings for data display, and when I started looking at the effort required to revert to using datasource methods for the NSOutlineView it seemed like a backwards step.

Cheers all -- Darren.





On 15/03/2006, at 2:13 AM, I. Savant wrote:


Oh, in addition, I wanted to say that this still won't help much for those trying to target 10.4. It's doubtful such a request will be fulfilled in any 10.4 updates. Even if they *don't* wait 'til 10.5 to make at least that method public, your app still depends on a specific 10.4.x update to use it properly. This creates a lot of additional maintenance work to make sure your code handles these differences gracefully and adds support difficulties when a clueless user tries to run it and doesn't know what you mean when you ask, "are you running 10.4.8 or above?". :-D The less hand- holding and extra coding I have to do to make sure something works properly, the more "profitable" the shareware business is for me.


These are the complications I decided to avoid when I abandoned NSTreeController for my app's upcoming incarnation. Not that NSTreeController is useless, it's just not useful to me for this particular problem. I suspect the same may be true for the OP, if using private API is a primary concern.

--
I.S.


On Mar 14, 2006, at 9:57 AM, Keith Wilson wrote:

Please file a request at http://bugreport.apple.com asking Apple to make the private method observedObject of _NSArrayControllerTreeNode made public. I want to use it too.

Keith

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


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:
40bigpond.net.au


This email sent to email@hidden



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

  • Prev by Date: Re: Controlling zoom level of an NSRulerView?
  • Next by Date: Re: Something like "[ NSDictionary dictionaryWithContentsOfFile:]" for situation when there is no file (and no URL either)
  • 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