• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do I remove all formatting (setUsesRuler:NO does not work) from an NSTextView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Douglas Davidson <email@hidden>
  • Date: Mon, 23 Sep 2002 12:39:12 -0700

On Friday, September 20, 2002, at 08:25 AM, 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?

Specifically what you are missing is the paragraph style; however, there are other attributes you may wish to consider. Here is the relevant method from the TextEdit example, which in addition to what you are doing, also applies a default set of attributes to the entire text (and sets them as the typing attributes), and removes any attachments:

- (void)setRichText:(BOOL)flag {
NSTextView *view = [self firstTextView];
NSDictionary *textAttributes;

isRichText = flag;

if (!isRichText) [self removeAttachments];

[view setRichText:isRichText];
[view setUsesRuler:isRichText]; /* If NO, this correctly gets rid of the ruler if it was up */
if (isRichText && [[Preferences objectForKey:ShowRuler] boolValue]) [view setRulerVisible:YES]; /* Show ruler if rich, and desired */
[view setImportsGraphics:isRichText];

textAttributes = [self defaultTextAttributes:isRichText];

if ([textStorage length]) {
[textStorage setAttributes:textAttributes range: NSMakeRange(0, [textStorage length])];
}
[view setTypingAttributes:textAttributes];
}

Douglas Davidson
_______________________________________________
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.

References: 
 >How do I remove all formatting (setUsesRuler:NO does not work) from an NSTextView? (From: Gerben Wierda <email@hidden>)

  • Prev by Date: Re: Scaling down an image proportionally
  • Next by Date: Re: NSTableView of NSColorWell
  • Previous by thread: Re: How do I remove all formatting (setUsesRuler:NO does not work) from an NSTextView?
  • Next by thread: Shielding Windows/Observations About Force Quit
  • Index(es):
    • Date
    • Thread