• 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: NSOutline view with draggable/reorderable items?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutline view with draggable/reorderable items?


  • Subject: Re: NSOutline view with draggable/reorderable items?
  • From: Clyde McQueen <email@hidden>
  • Date: Mon, 20 Aug 2001 23:14:29 -0700

It took me a lot of trial and error, and lots of re-reading of the Cocoa docs, but I got it to work nicely. For what it's worth, here are the methods I had to implement in my controller class (set up as both delegate and data source) to get it all to work:

// Minimal data source methods.
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;

// Minimal stuff for drag-n-drop.
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray*)items toPasteboard:(NSPasteboard*)pboard;
- (unsigned int)outlineView:(NSOutlineView*)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index;
- (BOOL)outlineView:(NSOutlineView*)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index;

You'll also have to register your drag (pasteboard) types after the nib is loaded. Definitely check out DropZone (versiontracker) when debugging drag and drop.

As for overriding the data cell & drawing icons - I'm clueless. I saw an example in SimpleBrowser, but is there an example that uses NSOutlineView? I tried the SimpleBrowser tricks, but I can't get them to work with NSOutlineView.

/Clyde

On Monday, August 20, 2001, at 06:57 AM, l.m.orchard wrote:

Playing with NSOutlineView's now, and I understand how to make datasources and I've run through the file system outline example that comes with the developer tools... But now I want to figure out how to make my outline like the project tree view on the left in Project Builder. That is, I want the option to have icons and maybe other controls there, and I especially want to be able to drag and reorder items in the outline.

I tried playing with OmniGroups's OAExtendedOutlineView, with no luck at all (and no docs), and I can't quite figure out what else to do with NSOutlineView.

This seems like a big RTFM question, but any pointers?

--
Leslie Michael Orchard <email@hidden>
ICQ: 492905 (home) 11082089 (work)
"...see you space cowboy..."
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Follow-Ups:
    • Re: NSOutline view with draggable/reorderable items?
      • From: Clyde McQueen <email@hidden>
References: 
 >NSOutline view with draggable/reorderable items? (From: "l.m.orchard" <email@hidden>)

  • Prev by Date: Re: NSTextView undo/redo question
  • Next by Date: "delete" character in menu
  • Previous by thread: NSOutline view with draggable/reorderable items?
  • Next by thread: Re: NSOutline view with draggable/reorderable items?
  • Index(es):
    • Date
    • Thread