• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView without word wrap
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView without word wrap


  • Subject: Re: NSTextView without word wrap
  • From: Mikael Hakman <email@hidden>
  • Date: Wed, 16 Oct 2013 13:11:25 +0200

Works as advertised. Many thanks.

/Mikael

On Oct 16, 2013, at 7:55 AM, Jens Alfke <email@hidden> wrote:

>
> On Oct 12, 2013, at 2:42 PM, Mikael Hakman <email@hidden> 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 (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


References: 
 >NSTextView without word wrap (From: Mikael Hakman <email@hidden>)
 >Re: NSTextView without word wrap (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Core Data with ODBC databases?
  • Next by Date: Re: Scrollable GridView with fixed row and column
  • Previous by thread: Re: NSTextView without word wrap
  • Next by thread: Re: NSTextView without word wrap
  • Index(es):
    • Date
    • Thread