Hi,

in NSTextView there is a method to handling writing textattachmentcells to the 
clipboard. I implemented the following and it seems to work:

- (NSArray *)textView:(NSTextView *)aTextView 
writablePasteboardTypesForCell:(id <NSTextAttachmentCell>)cell
              atIndex:(NSUInteger)charIndex;
{
    return [NSArray arrayWithObject:kDataCellTypeUTI];
}

- (BOOL)textView:(NSTextView *)aTextView
       writeCell:(id <NSTextAttachmentCell>)cell
         atIndex:(NSUInteger)charIndex
    toPasteboard:(NSPasteboard *)pboard type:(NSString *)type;
{
    if (type == kDataCellTypeUTI)
        [pboard writeObjects:[NSArray arrayWithObject:cell]];
    
    return YES;
}


Both get overridden and my custom textattachmentcell ends up on the pasteboard. 
But when pasting it and even though it does get pasted as a cell, the custom 
properties are the default values and not the ones from the copy on the 
pasteboard. initWithPasteboardPropertyList is never called nor initWithCoder, 
only the standard init method. The cell subclass subscribes to 
NSPastboardReading and -Writing protocol and implements all methods thereof. IS 
there anything else that needs to be done, or are textattachmentcells an 
exception to the pasteboard in some way?

AR
_______________________________________________

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