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

[SOLVED] Re: Dragging from NSTableView


  • Subject: [SOLVED] Re: Dragging from NSTableView
  • From: Tito Ciuro <email@hidden>
  • Date: Wed, 1 Oct 2003 19:45:07 +0200

Hello again.

It looks like an AppKit bug.

draggingSourceOperationMaskForLocal is never called in the controller. The workaround is to subclass NSTableView and implement the code there.

Then it works like a charm.

Cheers,

-- Tito

On 1 oct 2003, at 17:12, Tito Ciuro wrote:

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

References: 
 >Dragging from NSTableView (From: Tito Ciuro <email@hidden>)

  • Prev by Date: Re: Can I use NSTextView this way?
  • Next by Date: Re: NSString creating problem when contains chinese font
  • Previous by thread: Dragging from NSTableView
  • Next by thread: NSString creating problem when contains chinese font
  • Index(es):
    • Date
    • Thread