Re: NSTableView Drag-Drop re-ordering...
Re: NSTableView Drag-Drop re-ordering...
- Subject: Re: NSTableView Drag-Drop re-ordering...
- From: chaitanya pandit <email@hidden>
- Date: Wed, 26 Nov 2008 14:11:03 +0530
To re-order the items in the tableView, you will have to implement a
custom drag type.
Say for example you name your custom drag type as @"myDragType"
then
1] Register your table view to accept this drag type using
"registerForDraggedTypes:" and passing an array containing
@"myDragType" along with super's drag types
2] In your tableView's data source, implement this method
"tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes
:" and return an array containing @"myDragType".
3] Implement "tableView:writeRowsWithIndexes:toPasteboard:" in your
data source and write any dummy data in the given pasteboard for type
@"myDragType", this can be the data representing the items/indexes
being dragged
4] Check for a valid drop with
"tableView:validateDrop:proposedRow:proposedDropOperation:"
5] Finally set the new indexes for the dragged items in
"tableView:acceptDrop:row:dropOperation:"
HTH,
Chaitanya
On 26-Nov-08, at 1:36 PM, Jean-Nicolas Jolivet wrote:
As I said... I have no problems with dragging files on the data
table... my table is already a drag destination and its working
well...with the bindings in place etc...
What I can't find is good info about re-ordering the table row with
drag and drop, and I did search google for the obvious key words
(NSTableView drag drop order, NSTableView re-order etc etc..)
But thanks anyway...
On 26-Nov-08, at 2:58 AM, mmalcolm crawford wrote:
On Nov 25, 2008, at 11:26 PM, Jean-Nicolas Jolivet wrote:
I'm pretty sure this has been covered before, however I can't find
any good examples on how to implement it??
<http://www.google.com/search?client=safari&rls=en-us&q=nstableview+drag+drop+bindings&ie=UTF-8&oe=UTF-8
>
<http://www.google.com/search?client=safari&rls=en-us&q=table+view++drag+drop+bindings&ie=UTF-8&oe=UTF-8
>
mmalc
Jean-Nicolas Jolivet
email@hidden
http://www.silverscripting.com
_______________________________________________
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
_______________________________________________
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