Re: NSOutline view with draggable/reorderable items?
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:41:50 -0700
Doh! I completely missed the "DragNDropOutlineView" example. A great
example. It answers all my questions. (E.g., you need to subclass
NSTextFieldCell to draw an image & text in the same cell in an outline
view.)
/Clyde
On Monday, August 20, 2001, at 11:14 PM, Clyde McQueen wrote:
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
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev