Re: Row dragging ...
Re: Row dragging ...
- Subject: Re: Row dragging ...
- From: Herr Witten <email@hidden>
- Date: Sat, 31 Jan 2004 17:43:42 -0500
Here is a better example:
- (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id
<NSDraggingInfo>)info row:(int)row
dropOperation:(NSTableViewDropOperation)operation
{
NSArray* objects = [NSKeyedUnarchiver unarchiveObjectWithData:
[[info draggingPasteboard] dataForType: @"draggingData"]];
NSMutableIndexSet* indexes = [NSMutableIndexSet
indexSetWithIndexesInRange: NSMakeRange(row, [objects count])];
if (operation == NSTableViewDropOn)
[indexes shiftIndexesStartingAtIndex: row by: 1];
[self insertObjects: objects atArrangedObjectIndexes: indexes];
[self removeObjects: _draggingObjects];
return YES;
}
On 31 Jan 2004, at 5:22 PM, Herr Witten wrote:
>
- (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id
>
<NSDraggingInfo>)info row:(int)row
>
dropOperation:(NSTableViewDropOperation)operation
>
{
>
NSMutableArray* content = [NSMutableArray arrayWithArray: [[self
>
content] copy]];
>
>
NSArray* objects = [NSKeyedUnarchiver unarchiveObjectWithData:
>
[[info draggingPasteboard] dataForType: @"draggingData"]];
>
>
/*go through objects and insert them into the proper places*/
>
>
return YES;
>
}
_______________________________________________
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.