Re: Programmatically creating NSScrollView in an NSTabView
Re: Programmatically creating NSScrollView in an NSTabView
- Subject: Re: Programmatically creating NSScrollView in an NSTabView
- From: "I. Savant" <email@hidden>
- Date: Tue, 9 Jan 2007 08:40:31 -0500
Have you considered the *origin* of the tab view's contentRect
when setting scroll view's frame?
--
I.S.
On Jan 9, 2007, at 7:26 AM, Joe Wildish wrote:
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
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