pasteFont in plain NSTextView
pasteFont in plain NSTextView
- Subject: pasteFont in plain NSTextView
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 10 Mar 2003 16:32:37 +0100
I have a non-rich (plain) subclass of NSTextView with this method:
- (void)pasteFont:(id)sender
{
NSLog(@"pasteFont");
[ super pasteFont: sender ] ;
}
This method gets called when I hit the Paste Font Menu, but nothing
gets done. Why?
The documentation says: "This action method pastes font information
from the font pasteboard onto the selected text or insertion point of a
rich text object, or over all text of a plain text object."
I have then replaced pasteFont: with this new method:
- (void)pasteFont:(id)sender
{
NSRange rang1 = [ self selectedRange ] ;
[ self setRichText: YES ] ;
[ self selectAll: nil ] ;
[ super pasteFont: sender ] ;
[ self setRichText: NO ] ;
[ self setSelectedRange: rang1 ] ;
}
Now the Paste Font Menu works.
My question: is this the correct way to implement paste font? Is there
a better or more efficient way?
Gerriet.
_______________________________________________
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.