• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Drag and Drop between two Tableviews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag and Drop between two Tableviews


  • Subject: Re: Drag and Drop between two Tableviews
  • From: Ryan Britton <email@hidden>
  • Date: Fri, 6 Jan 2006 06:53:29 -0800

You need to call this on the destination table view (modified for your needs, of course):

[yourTableView registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];


On Jan 5, 2006, at 5:12 PM, Steve Gran wrote:

As always I preface with the fact that I'm just learning how to program so please be gentle. I was looking at those good examples on mmalc's Cocoa Bindings Examples and Hints page. In particular, I'm trying to use drag and drop from one tableview to another tableview (controlled by a different array controller of course). I first tried to implement the three drag and drop methods...


- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard;


- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation: (NSTableViewDropOperation)op;

- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id <NSDraggingInfo>) info row:(int)row dropOperation:(NSTableViewDropOperation)op;

...in both of my array controllers. But then I got a bit lost. The drag part works but I can't seem to get the other tableview to accept the drop. In mmalc's example (it's the "Bookmarks" one) he has what he calls a utility method...

-(void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *)indexSet
				    toIndex:(unsigned)index;

...and I wonder if that's my problem and that I need something like this (but I just can't figure out what) for the "insert" role in the new array.

If someone can suggest the right way to do it or point me to a snipet of code that shows how to get drag and drop between two tableviews.

Thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Drag and Drop between two Tableviews (From: Steve Gran <email@hidden>)

  • Prev by Date: Re: Internationalization support
  • Next by Date: Re: Cocoa versus Carbon networking issue.
  • Previous by thread: Re: Drag and Drop between two Tableviews
  • Next by thread: Re: Drag and Drop between two Tableviews
  • Index(es):
    • Date
    • Thread