Works as advertised. Many thanks.

/Mikael

On Oct 16, 2013, at 7:55 AM, Jens Alfke <j...@mooseyard.com> wrote:

> 
> On Oct 12, 2013, at 2:42 PM, Mikael Hakman <mhak...@dkab.net> wrote:
> 
>> How can I make NSTextView not to do word wrap? Thanks.
> 
> Basically you have to make the view’s text container infinitely wide. Here’s 
> an implementation of a .wrapsLines property that I used in a subclass of 
> NSTextView a few years ago.
> 
> - (BOOL) wrapsLines {
>    return [self isHorizontallyResizable];
> }
> 
> - (void) setWrapsLines: (BOOL)wraps {
>    [self setHorizontallyResizable: !wraps];
>    NSSize containerSize = self.textContainer.containerSize;
>    containerSize.width = wraps 
> ?self.enclosingScrollView.documentVisibleRect.size.width :FLT_MAX;
>    [[self textContainer] setContainerSize: containerSize];
>    [[self textContainer] setWidthTracksTextView: wraps];
>    [[self enclosingScrollView] setHasHorizontalScroller: !wraps];
>    [self setNeedsDisplay: YES];
> }
> 
> —Jens
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/leakim.namkah%40gmail.com
> 
> This email sent to leakim.nam...@gmail.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to