tableView Drag and Drop frustration
tableView Drag and Drop frustration
- Subject: tableView Drag and Drop frustration
- From: Kurt Marek <email@hidden>
- Date: Sat, 1 Nov 2003 21:56:12 -0800
I'm trying to drag a dictionary of data from one table to another
within the same application. I cobbled together some methods from the
documentation and
http://www.nongnu.org/gstutorial/zh_TW/ch13s04.html
I've included the following in the datasource for my drag source table:
- (BOOL) tableView: (NSTableView *) view
writeRows: (NSArray *) rows
toPasteboard: (NSPasteboard *) pboard
{
NSLog(@"dragging");
id object = [[self arrangedObjects] objectAtIndex: [[rows
lastObject] intValue]];
NSData *data = [NSArchiver archivedDataWithRootObject: object];
[pboard declareTypes: [NSArray arrayWithObject:
@"NSGeneralPboardType"]
owner: nil];
[pboard setData: data forType: @"NSGeneralPboardType"];
return YES;
}
And I put the following in an awakefromnib method for the destination
table:
[destinationTableView registerForDraggedTypes: [NSArray
arrayWithObjects:NSGeneralPboardType, nil]];
The problem is that I get an error saying that NSGeneralPboardType is
undeclared in that last line of code. If I change this to
NSFilnamesPboardType just for error checking purposes then I can see
that the source table is working appropriately and lets me drag a row
out of my source table. Looking at the documentation, it doesn't appear
that NSGeneralPboardType is a stock type, but copying a dictionary
doesn't fall into any of the stock types. How do I get around this?
Kurt
_______________________________________________
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.