Re: enhancing NSTextView for optionally-hidden text
Re: enhancing NSTextView for optionally-hidden text
- Subject: Re: enhancing NSTextView for optionally-hidden text
- From: Ross Carter <email@hidden>
- Date: Wed, 21 Nov 2012 10:25:46 -0500
> Nov 21, 2012, at 2:26 AM, Quincey Morris <email@hidden> wrote:
>
>> On Nov 20, 2012, at 21:03 , Kurt Bigler <email@hidden> wrote:
>>
>>> Given how this view is used, for appending only in the style of an uneditable text log permitting user selections and Copy, the easiest way I can think to implement it is to maintain two text views, one with hidden text included, and one without, and simply swap the two views to implement show/hide of hidden text.
>>>
>>> Is there a better way? I would rather not get deep into a highly-structured text document kind of model in order to achieve something like this (assuming that even helps).
>>
>> Perhaps better than two views would be two attributed string properties (of the object that knows when the log changes). In one, you'd either mark the hideable text with the (unique?) attribute that indicates the hideability in the display, or with an custom attribute.
>
The way to do this is by subclassing NSGlyphGenerator to return null glyphs for text that has your custom Hidden attribute. A WWDC video from a few years back shows how.
_______________________________________________
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