Problems adding horiz scrollbar to NSTextView
Problems adding horiz scrollbar to NSTextView
- Subject: Problems adding horiz scrollbar to NSTextView
- From: "Bell, Carl" <email@hidden>
- Date: Mon, 22 Oct 2001 11:55:16 -0500
- Thread-topic: Problems adding horiz scrollbar to NSTextView
Howdy,
I am trying to add a horizontal scrollbar to a NSTextView and am having
problems. (Why doesn't IB support this? Or does it and I'm just missing
something?) My NSTextView (and its NSScrollView) is inside a
NSSplitView.
In awakeFromNib, I add the horizontal scrollbar with the following code:
[personInfoScroller setHasHorizontalScroller:YES];
[personInfoField setHorizontallyResizable:YES];
[[personInfoField textContainer] setWidthTracksTextView:YES];
{
NSSize size = [[personInfoField textContainer] containerSize];
size.width = 10000000;
[[personInfoField textContainer] setContainerSize:size];
}
The textview is initially empty. Later, when I add text to the textview
with setString:blah, the horizontal scroll bar is updated but
incorrectly
and scrolling all the way to the right doesn't scroll to the end of the
text. But if I resize the window so that the width is wider than the
text
and then resize it back, the scrollbar is correct from then on.
What am I missing?
-cb
________________________________________________________________________
Carl W. Bell <
http://www.baylor.edu/~Carl_Bell/index.html>
Sr. Analyst/Programmer Baylor University Academic Technology Center