Re: NSTableView: move rows through drag and drop?
Re: NSTableView: move rows through drag and drop?
- Subject: Re: NSTableView: move rows through drag and drop?
- From: Izak van Langevelde <email@hidden>
- Date: Wed, 10 Aug 2011 17:30:31 -0400
On 2011-08-10, at 5:11 PM, Jens Alfke wrote:
>
> On Aug 9, 2011, at 8:43 PM, Izak van Langevelde wrote:
>
>> Now I want to allow drag and drop from one document to another, and my first guess was to write the row data to the pasteboard.
>> What puzzles me, is how to delete the row data from the source data, in case of a move. That is, my acceptDrop inserts the row data into the destination data source, but the indexes of the source rows are not available at this point.
>
> And also consider that the destination of the drag could be a different app, in which case you don’t get an -acceptDrop: call at all.
>
> Instead, to handle the source end of a move (or delete, i.e. drag to Trash) you need to implement the NSDraggingSource protocol’s -draggedImage:endedAt:operation: method. If the operation was a move or delete, you should delete the dragged items.
I considered it, but it seems to have been available since Lion, and am looking for something which works on older systems.
I am a little surprised that there does not seem to be an elegant solution for inter-document drag-and-drop moves within the same application, other than keeping track of the row indexes in the source, putting the row numbers on the pasteboard and notifying the source of a successful move to the destination. I had expected to put the row data on the pasteboard to facilitate cross-document drag-and-drop, but as I need the row indexes anyway, it does not really make sense to put anything other than row indexes on the pasteboard.
---
Grinnikend door het leven...
_______________________________________________
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