Rearranging NSOutlineView via drag-and-drop
Rearranging NSOutlineView via drag-and-drop
- Subject: Rearranging NSOutlineView via drag-and-drop
- From: Charles Jenkins <email@hidden>
- Date: Sat, 03 Jan 2015 15:13:26 -0500
I may have gone about things wrong, but I added drag-and-drop rearrangement to a source view by implementing these NSOutlineViewDataSource methods:
outlineView:writeItems:toPasteboard:
outlineView:validateDrop:proposedItem:proposedChildIndex:
outlineView:acceptDrop:item:childIndex:
If all sanity checks pass, the latter function makes changes to my model and returns YES.
These things work, and I can verify that the object graph in the model has changed correctly. But to see the changes reflected in my Source View, I have to collapse and re-expand the affected nodes in order to have them reload data from the model in its new state. (I’m kind of surprised that updating the outline isn’t automatically done as a result of successfully accepting an NSDragOperationMove.)
Is it a good idea to call reload functions from outlineView:acceptDrop:item:childIndex:, or should I be doing something else to update the outline?
—
Charles Jenkins
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden