Re: TextView resize
Re: TextView resize
- Subject: Re: TextView resize
- From: email@hidden
- Date: Tue, 12 Mar 2002 18:07:13 -0800
Thanks but what if I dont have an NSScrollView attached to my textview?
In that case, you would use... setFrameSize:. :->
Basically what im trying to accomplish is that if the [textview
visiblerect] is smaller than the [textview frame], i want to resize the
textview so that the visible rect is the size of the textview frame
and all of the contents of the textview are displayed.
NSTextView has some somewhat unusual sizing behavior. You can
configure it to do what you seem to want it to do automatically. Just
do:
[textview setHorizontallyResizable:YES];
[textview setVerticallyResizable:YES];
There are caveats to doing this, however. You should read the doc
"Programming Topic: Text System Storage Layer", under "Tracking the size
of the NSTextView". The important bit reads:
"To allow an NSTextView to be resized in this manner, use NSTextView's
setVerticallyResizable: or setHorizontallyResizable: methods (which are
inherited from NSText) as needed, set the text container not to track
the size of its text view, and set the text container's size in the
appropriate dimension large enough to accommodate a great amount of
textabout 10,000,000 (this incurs no cost whatever in processing or
storage)."
Failing to follow all of these steps will potentially lead to an
infinite recursion as the textview and textcontainer each trigger
resizies in each other ad infinitum.
Ben Haller
Stick Software
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.