• 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: "Pierce T. Wetter III" <email@hidden>
  • Date: Tue, 14 Mar 2006 08:34:49 -0700


On Mar 14, 2006, at 5:21 AM, Darren Ford wrote:

Hi all,

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.

I've set up the delegate to the NSOutlineView to be my 'MyDocument' class, however I still don't receive any of the delegate messages. Since I don't have a traditional datasource (because of using the NSTreeController) using the NSOutlineViewDataSource protocol makes no sense (although I've tried it)

Any help or pointers to example code would be great.

Good News:

There exists a tutorial on the subject as others have pointed out. If you just want to experiment, that's fine. Bindings Rock!

Bad News:

As others have pointed out, NSTreeController is opaque, and in my experience, isn't particularly stable once you start willy-nilly rearranging heirarchies. I think its sort of over optimized in that it loves to cache objects that no longer exist and the sort of "tree of ArrayControllers" concept its using under the hood seems a little sensitive to notification order. I spent a lot of time trying to tweak my code around it before I gave up. Now I'm faking it with NSArrayController and NSTableView, and its much more stable.

Though if you're not using CoreData with it, that might help. I found the troika was causing me problems because I'd deleted/moved things, but the changes wouldn't get pushed to NSTreeController until processRecentChanges was called.

What others have done is write their own NSTreeController (no one has published any source yet though). Even then you'll still run afoul of the row height caching in NSOutlineView if you do variable row sizes, so you'll have to patch that as well with a category or subclass.

 Pierce



_______________________________________________
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>)

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