NSTextView.preferredPasteboardTypeFromArray
NSTextView.preferredPasteboardTypeFromArray
- Subject: NSTextView.preferredPasteboardTypeFromArray
- From: Chris Idou <email@hidden>
- Date: Mon, 26 Jan 2009 20:36:10 -0800 (PST)
I'm trying to make an NSTextView do something rational when someone drags a token from an NSTokenField. So I've got the NSTokenField producing a custom drag type I've called TokenPboardType.
I've inherited from NSTextView and redefined readablePasteboardTypes to be:
- (NSArray*)readablePasteboardTypes; {
NSMutableArray*rtn = [NSMutableArrayarrayWithObject:TokenPboardType];
[rtn addObjectsFromArray:[superreadablePasteboardTypes]];
returnrtn;
}
and I redefined - (BOOL)readSelectionFromPasteboard:(NSPasteboard*)pboard type:(NSString*)type;
to do what I want.
My trouble is that when I redefine - (NSString*)preferredPasteboardTypeFromArray:(NSArray*)availableTypes restrictedToTypesFromArray:(NSArray*)allowedTypes;
This method's list of allowedTypes when I do the drag doesn't include my TokenPboardType. Now if I return TokenPboardType anyway, it seems to work. my readSelectionFromPasteboard gets called with TokenPboardType and it all seems to work. But it feels like I'm doing the wrong thing somehow, since from the doco it sounds like you shouldn't return a type that is not in the allowedTypes.
Comments?
Stay connected to the people that matter most with a smarter inbox. Take a look http://au.docs.yahoo.com/mail/smarterinbox
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden