NSScrollView's non-scrollbar section
NSScrollView's non-scrollbar section
- Subject: NSScrollView's non-scrollbar section
- From: Sam Goldman <email@hidden>
- Date: Fri, 09 Nov 2001 20:07:43 -0800
I recently posted this on OmniGroups's cocoa list, but didn't get the answer
I was looking for. Now, I did study the documentation (including superviews)
and source code, and have come to a conclusion. I think that I need to
manually make an NSRect, but I may have missed something.
I am putting a NSTextView into a NSScrollView and have gotten it to work --
sort of.
What happens is that when I type into the NSTextView and reach the scroll
bar of the NSScrollView, it keeps on typing in that line for a while and
then goes down a line. I figure the problem is that the scroll bar and/or
some tiny frame around the perimeter of the NSScrollView is making
[myScrollView bounds] larger than it should be.
I have tried every imaginable combination of method that returns a NSRect
and it still doesn't work.
Another added problem is that the NSScrollView has to resize to a
NSTabViewItem's view. That makes things more difficult.
Here's the code that I am using right now to position the views:
NSScrollView *myScrollView = [[NSScrollView alloc] initWithFrame:[[[tabView
tabViewItemAtIndex:0] view] bounds]];
NSTextView *myTextView = [[NSTextView alloc] initWithFrame:[myScrollView
bounds]];
[myScrollView setHasVerticalScroller:YES];
[myTextView setAutoresizingMask:18];
[myScrollView setAutoresizingMask:18];
[[tabView tabViewItemAtIndex:0] setView:myScrollView];
[myScrollView setDocumentView:myTextView];
Does this make sense to anyone. While positioning in IB would be better and
easier, it is not an option.
Thanks,
Sam