Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: NSTextView re-implementing word wrapping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView re-implementing word wrapping



Sorry, I didn't post code because it was in Pascal, but it's easy enough to read (remember the old Inside Macintosh books?). I could re- write in Objective-C if anyone needed...

setMaxSize: and setWidthTracksTextView: are the culprits here and simply reversing them doesn't work because I don't which "max size" would correspond to "wrapping". Thanks for helping.

The code:

   textView.setHorizontallyResizable(true);
   layoutSize := textView.maxSize;
   layoutSize.width := layoutSize.height;

   textView.setMaxSize(layoutSize);
   textView.textContainer.setWidthTracksTextView(false);
   textView.textContainer.setContainerSize(layoutSize);

On Apr 28, 2009, at 6:55 AM, Martin Wierschin wrote:

After reading through the archives I learned how to turn off word wrapping in NSTextView by calling a few methods in both NSText and NSTextContainer but calling them in reverse order (reverting the effect) did not restore word wrapping properly.

In particular I think the problem is setContainerSize. If I set it to a fixed width, text is wrapped but I would like it to follow the view bounds like it did originally. Is there a meta-value or something else I need to give it?

I suppose you've called setWidthTracksTextView: and setHeightTracksTextView: as needed? If you post your code it would be easier to help you.


~Martin


Regards, Josef

_______________________________________________

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 re-implementing word wrapping (From: Ryan Joseph <email@hidden>)
 >Re: NSTextView re-implementing word wrapping (From: Martin Wierschin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.