Re: setting NSScrollView content width to NSText width
Re: setting NSScrollView content width to NSText width
- Subject: Re: setting NSScrollView content width to NSText width
- From: Martin Hewitson <email@hidden>
- Date: Tue, 16 Mar 2010 21:43:59 +0100
Hi Dave,
I'm not sure I've understood exactly, but perhaps the following get's you going in the right direction:
[textView setHorizontallyResizable:YES];
[[textView textContainer] setWidthTracksTextView:NO];
[textView setMaxSize:NSMakeSize(10000, FLT_MAX)];
Best wishes,
Martin
On Mar 16, 2010, at 9:15 PM, David Alter wrote:
> I dynamically create a NSScrollView and place and NSTextView inside of it. I
> want the width of the content view to expand with the text. Basically the
> same way the xCode editor works. The horizontal scroll bar adjusts as texts
> is added. The width of the content view is the width of the longest line of
> texts in NSTextView. There does not appear to be a simple way to set this
> for the NSScrollView. I can adjust the width on the frame of my NSTextView
> and that will adjust my NSScrollView. Is that the recommended way of doing
> this? If that is, then is there an easy way to get the Width of the longest
> line of text in the NSTextView?
>
> thanks for the help
> -dave
> _______________________________________________
>
> 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
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