• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programmatically creating NSScrollView in an NSTabView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically creating NSScrollView in an NSTabView


  • Subject: Re: Programmatically creating NSScrollView in an NSTabView
  • From: Joe Wildish <email@hidden>
  • Date: Wed, 10 Jan 2007 20:02:05 +0000 (GMT)

For the record, I figured this out - I had screwed up my nib file and managed to mis-align the view. It was difficult to see in the nib file cos there was no border. Oops! I could have sworn I checked that before posting, but obviously not. Apologies! :-/

Regards,
-Joe

On Tue, 9 Jan 2007, Joe Wildish wrote:

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

_______________________________________________

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


References: 
 >Programmatically creating NSScrollView in an NSTabView (From: Joe Wildish <email@hidden>)
 >Re: Programmatically creating NSScrollView in an NSTabView (From: "I. Savant" <email@hidden>)
 >Re: Programmatically creating NSScrollView in an NSTabView (From: Joe Wildish <email@hidden>)

  • Prev by Date: Re: Parsing PDF Content
  • Next by Date: [MEET] CocoaHeads Thursday in San Francisco!
  • Previous by thread: Re: Programmatically creating NSScrollView in an NSTabView
  • Next by thread: Checking Quartz Extreme & Altivec Relationship?
  • Index(es):
    • Date
    • Thread