Re: Programmatically creating NSScrollView in an NSTabView
Re: Programmatically creating NSScrollView in an NSTabView
- Subject: Re: Programmatically creating NSScrollView in an NSTabView
- From: Joe Wildish <email@hidden>
- Date: Tue, 9 Jan 2007 13:57:03 +0000 (GMT)
I.S.,
The contentRect returns a rect which has it's origin as x:0.0 y:0.0 ..
which AFAIK is fine. I've just done some quick testing, and I'm getting
odd behaviour; I just tried to initWithFrame: on the scroll view with a
frame of NSMakeRect(0,0,10,10) ... and I'm getting the same results! ie.
the scroll view is filling the contents of the tab view, plus a little
more on the side, therefore obscuring the slider. I must be missing
something in how this hangs together, as I don't see how that is
possible...!
Regards,
-Joe
On Tue, 9 Jan 2007, I. Savant wrote:
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:
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