Re: Drag and drop between two table views.
Re: Drag and drop between two table views.
- Subject: Re: Drag and drop between two table views.
- From: Paul Johnson <email@hidden>
- Date: Wed, 27 Oct 2010 22:38:41 -0500
Thanks, Graham. I've almost got it working. I did implement the drop
validation method and in my initWithNib method I did set up the destination
to receive the drag type. That's all working fine.
I took your suggestion to archive the array to a NSData object. I needed to
implement encodeWithCoder for the object that defines the data for a row
(containing 3 columns with an NSString in each column). I used the Data
Modeler to define the row objects and then created the initial declaration
and implementation files. Now I needed to added encodeWithCoder and
initWithCoder methods.
Now I'm getting the message "*Failed to call designated initializer on
NSManagedObject class 'Market'"*
*when I try to unarchive. I'm really unclear on how to work with Core Data
in this situation.*
*
*
*The source table and destination table are each supplied data using
separate managed object contexts. (The model for the destination table just
has an additional relationship defined, but the attributes are the same
otherwise.) I just need to move the three NSStrings for each selected row.
I don't see why I need to mess with NSManagedObject class.*
*
*
*What I probably should be doing is writing to the pasteboard **an array
that only has the 3 NSStrings per selected row, leaving out anything about
managed objects. I'm not sure how to do that.*
*
*
*I no doubt haven't described this very well as I'm just learning the
terminology, but I hope you can decrypt what I'm trying to say.
*
On Wed, Oct 27, 2010 at 6:59 PM, Graham Cox <email@hidden> wrote:
> Another thing.
>
> You should also implement:
>
> - (NSDragOperation)tableView:(NSTableView *)aTableView validateDrop:(id
> <NSDraggingInfo >)info
> proposedRow:(NSInteger)rowproposedDropOperation:(NSTableViewDropOperation)operation
>
> This should check whether 'BFDragPasteboardType' is actually present on the
> pasteboard, using the pb method -availableTypeFromArray: and return
> NSDragOperationCopy if it's there, and NSDragOperationNone otherwise.
>
> Look up "Drag and Drop in Tables" in the "Tableview Programming Guide". It
> tells you all you need to know.
>
> --Graham
>
>
>
_______________________________________________
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