Embarrassingly simple problem, but I can’t figure it out.

I have an NSTableView, and when dragging and dropping I want to encode my 
object as strings so I can drop them right into a text document or an email 
message.

I’m trying a very simple test (I just want the string “foo” to be dropped in an 
email message) that I cannot seem to make work. What am I missing? 
(setString:forType: is returning YES)

- (void)awakeFromNib
{
        [self.jocksTable registerForDraggedTypes: [NSArray arrayWithObjects: 
NSPasteboardTypeString, nil]];
        [self.jocksTable setDraggingSourceOperationMask:NSDragOperationEvery 
forLocal:NO];
}


- (BOOL)tableView:(NSTableView *)tv
writeRowsWithIndexes:(NSIndexSet *)rowIndexes
         toPasteboard:(NSPasteboard *)pboard;
{
        [pboard declareTypes: [NSArray arrayWithObject: NSPasteboardTypeString]
                                   owner: self];
        if ([pboard setString: @"foo" forType: NSPasteboardTypeString] == YES) {
                NSLog(@"setString worked");
                return YES;
        }
        return NO;
}


Thanks,

Todd

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to