Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-27 Thread Dave
> On 27 Apr 2016, at 09:01, Martin Wierschin wrote: > > This code is never going to work: > >> [[myTextView textStorage] addAttribute:NSParagraphStyleAttributeName >> value:[NSNumber numberWithInt:NSLineBreakByTruncatingTail] range:myRange]; >> >> But this results in nothing being displayed i

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-27 Thread Martin Wierschin
This code is never going to work: > [[myTextView textStorage] addAttribute:NSParagraphStyleAttributeName > value:[NSNumber numberWithInt:NSLineBreakByTruncatingTail] range:myRange]; > > But this results in nothing being displayed in the ScrollView/TextView. In fact, using that code probably thr

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-26 Thread Graham Cox
> On 27 Apr 2016, at 9:29 AM, Graham Cox wrote: > > [[theTextView textContainer] setContainerSize:NSMakeSize(contentSize.width, > FLT_MAX)]; Oops, that should be: [[theTextView textContainer] setContainerSize:NSMakeSize(FLT_MAX, contentSize.height)]; G. __

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-26 Thread Graham Cox
> On 26 Apr 2016, at 8:25 PM, Dave wrote: > > 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. [[theTextView textContainer] se

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-26 Thread Dave
Hi, I did do quite a few searches but I didn’t find that - I’m not that good at formulating the correct search string, I think was trying things like "NSScrollView Truncate Text”. Anyway, I managed to piece together something that would and I created a Category method on NSScrollView so I will

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-26 Thread Gary L. Wade
Did you try doing an internet search? This search phrase in Google has a number of people asking the same thing with many variations on the same answer: how to prevent nstextview from wrapping

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-26 Thread Dave
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 begi

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-26 Thread Bill Cheeseman
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 truncat

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-25 Thread Graham Cox
> On 26 Apr 2016, at 2:08 AM, Dave wrote: > > If anyone knows the secret please let me know! Set the associated text container to an extremely wide width. The text won’t wrap unless there’s a line break. —Graham ___ Cocoa-dev mailing list (Coco

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-25 Thread Dave
I tried the following: myTextView = [self documentView]; [[[myTextView textStorage] mutableString] appendString:theString]; myRange = NSMakeRange(0,[[[myTextView textStorage] mutableString] length] - 1); [[myTextView textStorage] addAttribute:NSParagraphStyleAttributeName value:[NSNumber numberW

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-25 Thread Dave
Hi Bill, 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. I’m just appending an NSString to the Docum

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-25 Thread Bill Cheeseman
> On Apr 25, 2016, at 6:48 AM, Dave wrote: > > I can’t believe its this hard to set wrapping or not and I can’t find real > info on this from searching either. For your purposes, the key point is that NSTextStorage is a subclass of NSMutableAttributedString, which is in turn a subclass of NS

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-25 Thread Dave
I’ve found the Text Storage like this: NSTextStorage* myTextStorage; myTextStorage = [[self.pLogScrollView documentView] textStorage]; > You can control trucation behavior in an NSTextView by using NSTextStorage, > which is a subclass of NSMutableAttributedString. The truncation method

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-24 Thread Bill Cheeseman
> On Apr 24, 2016, at 1:13 PM, Dave wrote: > > I’ve got the Text View Selected in XCode/IB and I can’t find any option for > “Layout” in any of the property tabs? Auto-layout is off at the moment for > this window, it wouldn’t have anything to do with that would it? I was describing text fiel

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-24 Thread Dave
Hi, > On 24 Apr 2016, at 17:29, Bill Cheeseman wrote: > > >> On Apr 24, 2016, at 12:04 PM, Dave > > wrote: >> >> I’m not sure what you mean? Is this a method or property on NSScrollView or >> NSTextView? >> >> I can’t see it in the XIB file? > > > In an NST

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-24 Thread Bill Cheeseman
> On Apr 24, 2016, at 12:04 PM, Dave wrote: > > I’m not sure what you mean? Is this a method or property on NSScrollView or > NSTextView? > > I can’t see it in the XIB file? In an NSTextField, IB shows you the "Layout" pop-up menu, which includes a "truncate" item, and the "Uses Single Line

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-24 Thread Dave
Hi, I’m not sure what you mean? Is this a method or property on NSScrollView or NSTextView? I can’t see it in the XIB file? Cheers Davw > On 24 Apr 2016, at 16:58, Andreas Mayer wrote: > > >> Am 24.04.2016 um 17:15 schrieb Dave : >> >> I have an NSTextView inside an NSScrollView. At prese

Re: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-24 Thread Andreas Mayer
> Am 24.04.2016 um 17:15 schrieb Dave : > > I have an NSTextView inside an NSScrollView. At present the Text Lines is > wrapped if they are longer than the Scroll View, I'd them to truncate. I had > thought I’d seen some properties somewhere for doing this but I can’t find > them in IB. NSPar

How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-24 Thread Dave
Hi All, I know this has been covered before but I can’t for the life of me find it by searching. I have an NSTextView inside an NSScrollView. At present the Text Lines is wrapped if they are longer than the Scroll View, I'd them to truncate. I had thought I’d seen some properties somewhere for