• 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: Making an NSTextView plain text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making an NSTextView plain text


  • Subject: Re: Making an NSTextView plain text
  • From: Satoshi Matsumoto <email@hidden>
  • Date: Sun, 18 Jul 2004 21:54:52 +0900

Hi Moray,

on 04.7.18 8:50 PM, MT at email@hidden wrote:
> I'm trying to deformat a NSTextView, i.e. return it to plain text (like
> Apple Mail's 'Make Plain Text'), remove all formatting. I thought
> setRichText:NO would do it, but it doesn't.
>
> I also tried getting the text with string: and setting it back when
> setRichText was still NO, again, formatting persists.

Refer TextEdit Document.m source code:

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

isRichText = flag;

if (!isRichText && attachmentFlag) [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];
paragraphStyle = [textAttributes
objectForKey:NSParagraphStyleAttributeName];

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

Satoshi,
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802
_______________________________________________
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: 
 >Making an NSTextView plain text (From: MT <email@hidden>)

  • Prev by Date: Re: Avoiding 'cannot find method' warnings with delegates?
  • Next by Date: Re: Get the latest song pathname played by iTunes
  • Previous by thread: Making an NSTextView plain text
  • Next by thread: Image Algorithms?
  • Index(es):
    • Date
    • Thread