Re: TableView drag&drop entries
Re: TableView drag&drop entries
- Subject: Re: TableView drag&drop entries
- From: John Nairn <email@hidden>
- Date: Fri, 10 Oct 2003 11:14:50 -0600
I just added drag and drop entries to a table with just one column and
it went pretty much as in documentation (once I understood it). The
minimal implementation seems to be:
In table delegate support the functions:
// Write drag type to paste board. Be sure to register the table view
to accept the
// paste board type created and finally return YES
- (BOOL)tableView:(NSTableView *)tableView writeRows:(NSArray *)rows
toPasteboard:(NSPasteboard *)pboard
// return operation (or change if desired)
- (NSDragOperation)tableView:(NSTableView*)tableView validateDrop:(id
<NSDraggingInfo>)info
proposedRow:(int)row
proposedDropOperation:(NSTableViewDropOperation)operation
{
return operation;
}
// drag is done - rearrange data if needed and return YES
- (BOOL)tableView:(NSTableView*)tableView acceptDrop:(id
<NSDraggingInfo>)info
row:(int)row
dropOperation:(NSTableViewDropOperation)operation
The last step that made it work was to be sure to register the table to
look for my private paste board type with
[recordsTable registerForDraggedTypes:
[NSArray arrayWithObjects:@"RecordListPBoardType",nil]];
On Friday, October 10, 2003, at 10:36 AM,
email@hidden wrote:
>
Hello
>
>
Is there somewhere a simple example how to drag tableView entries
>
around in
>
the table? And when the user dragged the entry, I want to change in my
>
MutableArray the array indexes like they are now in the table. Anyone
>
did
>
that before and can help?
>
>
Thanks
>
David
------------
John Nairn (1-801-581-3413, FAX: 1-801-581-4816)
Web page:
http://www.eng.utah.edu/~nairn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.