Programmatically creating NSScrollView in an NSTabView
Programmatically creating NSScrollView in an NSTabView
- Subject: Programmatically creating NSScrollView in an NSTabView
- From: Joe Wildish <email@hidden>
- Date: Tue, 9 Jan 2007 12:26:07 +0000 (GMT)
All,
I've searched the web etc, and have drawn a bit of blank on this, hence
the post. I am trying to create an NSScrollView programmatically inside an
NSTabViewItem instance.
The NSTabView and NSTabViewItem exist in the window in the nib, and the
size of the NSTabView is such that the edge is flush with the edge of the
window. The tabs themselves are not displayed and the style is no border
being drawn.
When I create the NSScrollView, it works, but the scroller along the
vertical is drawn partially outside the bounds of the view (and therefore
the window). I am assuming that my initWithFrame: argument is to blame,
but I can't see how. Here is the code I use to create the scrollview
(tabView is declared as an IBOutlet):
- (void)windowDidLoad
{
// create contents for console tab
NSTabViewItem * consoleTab = [tabView tabViewItemAtIndex:0];
NSScrollView * sv =
[[NSScrollView alloc] initWithFrame:[tabView contentRect]];
[sv setHasVerticalScroller:YES];
[sv setHasHorizontalScroller:YES];
[sv setAutohidesScrollers:YES];
[sv setBorderType:NSNoBorder];
// ... 8< code snipped to add NSTextView inside the sv .. 8<
[consoleTab setView:sv];
[sv release];
}
So, I am taking the contentRect of the tabView to be the size of my
NSScrollView, which seems logical, but draws the view such that the
vertical scroller is slightly obscured. Can anyone tell me where I'm going
wrong?
Regards,
-Joe
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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