How would you make a Outline view able to be re-ordered (dragging to move the position of a row) like a Table View. At the moment when I try and Drag a row it just selects other rows. How can I make It re-orderable?
You must implement the drag'n drop stuff.
These are the methods you have to implement in your NSOutlineView datasource.
- (NSDragOperation)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;
Check NSOutlineViewDataSource Protocol Reference for detailed info.
You also need to register drag types for your outlineView
[outlineView registerForDraggedTypes: [NSArray arrayWithObjects: NSStringPboardType, NSURLPboardType, NSFilenamesPboardType,NSFileContentsPboardType, nil]];
If you are finding the Apple docs difficult, try reading Jonathan's post about re-ordering.
Okay, well if that's a bit much, try the AbstractTree sample code from Apple's ADC site. The Drag and drop methods are highlighted in the AppDelegate files.
I don't wish to sound rude, but are you working through a tutorial or looking at references? I ask because just requesting code that you can paste in isn't going to be helpful to you: There isn't generic code that you can just drop in. it needs to be written for your specific case. Without knowing about these, we can't just write your methods for you.
Try and implement the example drag and drop methods from AbstractTree, and if you are still having trouble, try posting the code that you have written that isn't working.