Re: How do I remove all formatting (setUsesRuler:NO does not work) from an NSTextView?
Re: How do I remove all formatting (setUsesRuler:NO does not work) from an NSTextView?
- Subject: Re: How do I remove all formatting (setUsesRuler:NO does not work) from an NSTextView?
- From: Jeremy Dronfield <email@hidden>
- Date: Fri, 20 Sep 2002 18:40:48 +0100
On Friday, September 20, 2002, at 04:25 pm, Gerben Wierda wrote:
I have an NSTextView that alternately displays RTF data and ASCII data.
When the RTF data has been displayed, some aspects of it linger, mainly
the ruler. When I display pure ASCII the text displays indented.
I tried:
[__inspectView setRichText:NO];
[__inspectView setUsesRuler:NO];
[__inspectView setFont:__fixedFont];
but to no avail, the ASCII text is displayed indented. What am I
missing here?
If I understand your problem correctly, replacing the above code with
the following, which restores the default alignment
(NSNaturalTextAlignment), ought to solve it:
NSParagraphStyle *paraStyle = [NSParagraphStyle defaultParagraphStyle];
[[__inspectView textStorage] addAttribute:NSParagraphStyleAttributeName
value:paraStyle range:NSMakeRange(0, [[__inspectView string] length])];
Note, it will only work if there is text in the view, but it should be
easy enough to overcome this limitation. Hope this helps.
-Jeremy
========================================
email@hidden // email@hidden
The Alchemy Pages:
- fractious fiction at
http://freespace.virgin.net/jeremy.dronfield
========================================
_______________________________________________
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.