Re: What is the preferred way to set NSTextView content from NSAttributedString?
Re: What is the preferred way to set NSTextView content from NSAttributedString?
- Subject: Re: What is the preferred way to set NSTextView content from NSAttributedString?
- From: Jonathan Prescott via Cocoa-dev <email@hidden>
- Date: Sun, 2 Feb 2020 18:01:53 -0500
Looking at the documentation for NSTextView, it is highly recommended that you
manipulate the NSTextStorage associated with the view. NSTextStorage is a
sub-class of NSMutableAttributedtString, so you have all of those capabilities
as well.
I’m just getting into this as well for my console application related to my
expert system interface.
Jonathan
> On Feb 2, 2020, at 3:37 PM, Jeff Younker <email@hidden> wrote:
>
> Yes, I've set needsDisplay = true in my attempts to so far. Also needsLayout
> = true.
>
> The question I've got though is what is the recommended way of setting the
> value to T2. There is no attributedString variable, just an accessor method,
> so I've been trying a variety of insert methods.
>
> -jeff
>
> On Sun, Feb 2, 2020 at 12:19 PM Jonathan Prescott <email@hidden
> <mailto:email@hidden>> wrote:
> Did you tell V that it needs to re-load it’s display? There is a method on
> NSView (from which NSTextView is derived) called “needsDisplay(sic)” which
> sets a flag on the view so that the view will re-draw its content the next
> display cycle. So, after you set the content to T2, you need to call
> “V.needsDisplay()” so that the next display cycle the view gets refreshed.
> Need to check the spelling of the method.
>
> Jonathan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden