• 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
Dragging from NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dragging from NSTableView


  • Subject: Dragging from NSTableView
  • From: Tito Ciuro <email@hidden>
  • Date: Wed, 1 Oct 2003 17:12:00 +0200

Hello,

I'm stuck with a fairly easy feature: dragging data out of a tableview. I've read the requirements and I believe I understand them, but somehow my code doesn't work. I've looked in Cocoa Mamasan and the Omni Group dev list, but haven't found an answer.

All I want is to drag a string out of the table view, as shown in the code below, and let other apps like TextEdit to capture it via drop. Instead, the drag starts but when I drop it in a TextEdit document, it slides back:

- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag
{
return NSDragOperationCopy;
}

- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard
{
if (tv == _mapoRecordsTableView) {
[pboard declareTypes: [NSArray arrayWithObjects: NSStringPboardType, nil] owner: self];

BOOL result = [pboard setString: @"This is a test" forType: NSStringPboardType];

if (result)
NSLog(@"tableView:writeRows:toPasteboard: OK");
else
NSLog(@"tableView:writeRows:toPasteboard: FAILED");

return result;
}

return NO;
}

- (void)pasteboard:(NSPasteboard *)sender provideDataForType:(NSString *)type
{
NSLog(@"pasteboard:provideDataForType: called...");
}

What am I doing wrong?

Thanks in advance.

-- Tito
_______________________________________________
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.

  • Follow-Ups:
    • [SOLVED] Re: Dragging from NSTableView
      • From: Tito Ciuro <email@hidden>
  • Prev by Date: Re: Reading The Text of PDF files
  • Next by Date: Re: Reading The Text of PDF files
  • Previous by thread: NSURL Query
  • Next by thread: [SOLVED] Re: Dragging from NSTableView
  • Index(es):
    • Date
    • Thread