Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
- Subject: Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo
- From: Dave <email@hidden>
- Date: Tue, 26 Apr 2016 11:25:22 +0100
Hi,
I’ve tried loads of different way of doing it but none of them work. Maybe its because I’m not using Auto-Layout, maybe its just impossible using an NSScrollView/NSTextView. In fact, since there isn’t a handy-dandy method or property on any of the classes in question to just do it, I’m beginning to think that’s the case.
Apple’s documentation is so bad that I can’t find anything related to it and I must have wasted around 2 hours fiddling with this. Still I have lots of lovely animations in XCode to make up for it so all is not lost! I’m giving up and it’s too much of a time-sync to muck around with it as I have more pressing things that need doing.
Thanks a lot for for taking the time to help.
All the Best
Dave
> On 26 Apr 2016, at 10:00, Bill Cheeseman <email@hidden> wrote:
>
> Graham Cox is right.
>
> I realized overnight that I was misinterpreting your question. I happen to be working on truncation of text myself, and I was focused on the usual meaning of "truncation" in the attributed string context. It means placing three periods at the end or in the middle of truncated lines of text.
>
> What you are trying to do, as I now understand it, is to keep the original line breaks of the text in place, without "wrapping," even though the text view or window is made narrower. In other words, your text view will act like a peephole into a bigger page. That is what NSTextContainer is for. I think the references I gave to you for text handling in general will lead you to the relevant documentation.
>
> From the NSTextContainer reference document:
>
> "The NSTextContainer class defines a region where text is laid out. An NSLayoutManager <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSLayoutManager_Class/index.html#//apple_ref/occ/cl/NSLayoutManager> uses NSTextContainer to determine where to break lines, lay out portions of text, and so on. An NSTextContainerobject normally defines rectangular regions, but you can define exclusion paths inside the text container to create regions where text does not flow. You can also subclass to create text containers with nonrectangular regions, such as circular regions, regions with holes in them, or regions that flow alongside graphics."
>
> Since you're in a very speed-sensitive environment, you will also be interested in the paragraph that follows that quoted text, about using threads.
>
>> On Apr 25, 2016, at 11:34 AM, Dave <email@hidden <mailto:email@hidden>> wrote:
>>
>> I’m familiar with NSAttributedString and friends. I had thought that there was a higher level interface to it as it seems like a common thing to want to do.
>>
>> Basically my ScrollView is just a scrolling line log similar to XCode’s NSLog window.
>
> --
>
> Bill Cheeseman - email@hidden <mailto:email@hidden>
>
> --
>
> Bill Cheeseman - email@hidden
>
> _______________________________________________
>
> 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
_______________________________________________
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