[Biococoa-dev] KDTextView update
Koen van der Drift
kvddrift at earthlink.net
Fri Apr 14 07:41:41 EDT 2006
On Apr 13, 2006, at 9:28 PM, Koen van der Drift wrote:
> We also need a method to return a plain NSString from richtext
> input, though. For instance, I copy-pasted the short sequence that
> Alex gave as an example (ATTAATAGATGAF ), but that was rich text
> from Mail.app, so it showed up as follows in the view:
>
> rtmacanscgccartccasbrtnttbswsscharstHvtcacrtbrdgrnbdtabardardtabnatras
> cATTAATAGATGA
>
> I couldn't find a method in the FoundationKit, so I started a
> category method in BCUtilString, but it is not working yet. This
> method can then also be used in BCSequenceReader.
I think I solved that, I changed readSelectionFromPasteboard in
BCSequenceView to only accept NSStringPboardType:
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:
(NSString *)type{
// the docs say to call this first, so we do ;-)
[pboard types];
// try to read a string, if not succesful bummer, otherwise insert it
NSString *aString = [pboard stringForType: NSStringPboardType]; //
only accept plain strings
if(aString){
[self insertText: aString];
return YES;
}
else
return NO;
}
Would this break anything else? If not, I will commit it.
cheers,
- Koen.
More information about the Biococoa-dev
mailing list