• 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: NSOutlineView + NSTreeController + Drag & Drop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView + NSTreeController + Drag & Drop


  • Subject: Re: NSOutlineView + NSTreeController + Drag & Drop
  • From: Scott Stevenson <email@hidden>
  • Date: Wed, 15 Jun 2005 12:59:27 -0700


On Jun 14, 2005, at 5:55 AM, Frank Illenberger wrote:

I am using Cocoa bindings on a NSOutlineView using a NSTreeController which works alright. Now I want to add a data source to support drag & drop on that outline view.
Sadly, this does not work and I get the following exception:


*** Illegal NSOutlineView data source (<METreeController: 0x3a0620> [entity: Activity]). Must implement outlineView:numberOfChildrenOfItem:, outlineView:isItemExpandable:, outlineView:child:ofItem: and outlineView:objectValueForTableColumn:byItem:

It seems as NSOutlineView does not know about the tree controller and expects a classical data source.

When I use the same setup with a NSTableView and an NSArrayController, I am able to supply a data source that only delivers delegate methods for drag & drop.

Has anybody solved this problem yet or is this a bug in Cocoa?


Implement them like this:

- (BOOL) outlineView: (NSOutlineView *)ov isItemExpandable: (id)item { return NO; }
- (int) outlineView: (NSOutlineView *)ov numberOfChildrenOfItem:(id) item { return 0; }
- (id) outlineView: (NSOutlineView *)ov child:(int)index ofItem:(id) item { return nil; }
- (id) outlineView: (NSOutlineView *)ov objectValueForTableColumn: (NSTableColumn*) col byItem:(id)item { return nil; }



You'll also need to know about some private API to pull off drag and drop using the "item" and "items" objects passed into the delegate methods:


    -(id)observedObject;

This method is implemented by the proxy objects that are passed to you by NSTreeController. It works fine, but you'll get a compiler warning.

     - Scott

--
http://theocacao.com/
feed://theocacao.com/index.rss


_______________________________________________ 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: 
 >NSOutlineView + NSTreeController + Drag & Drop (From: Frank Illenberger <email@hidden>)

  • Prev by Date: Re: Drawing over a view's subviews
  • Next by Date: Re: Modal Dialog and Drag & Drop in a NSTableView
  • Previous by thread: NSOutlineView + NSTreeController + Drag & Drop
  • Next by thread: Re: Ordered Core Data
  • Index(es):
    • Date
    • Thread