• 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: How to add NSScrollView automatically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add NSScrollView automatically?


  • Subject: Re: How to add NSScrollView automatically?
  • From: Andy Lee <email@hidden>
  • Date: Fri, 9 Apr 2004 17:20:12 -0400

On Apr 9, 2004, at 3:43 PM, Michael Becker wrote:
However, when I try to put myCustomView in a ScrollView/ClipView-pair, it doesn't work:

NSClipView *clip = [[ NSClipView alloc] initWithFrame:NSMakeRect(0,0,300,300)];

NSScrollView *scroll = [[ NSScrollView alloc] initWithFrame:NSMakeRect(0,0,400,400)];
[ scroll setBorderType:NSBezelBorder];
[ scroll setHasVerticalScroller:YES];
[ scroll setContentView:clip];

The scrollview will create its own clipview, so you don't have to mess with that.

Here's roughly what I do:

_scrollView = [[NSScrollView alloc] initWithFrame:[self bounds]];

// ... set attributes of _scrollView...

NSTextView *textView =
[[[NSTextView alloc] initWithFrame:[self bounds]] autorelease];

// ... set attributes of textView...

[textView setFrame:[[_scrollView contentView] bounds]];
[_scrollView setDocumentView:textView];

Also are those NSMakeRect()'s providing dummy-information, since the TabViewItem seems to fit its view to its bounds (which is what I want). Will the ClipView also be sized to fit the ScrollView?

I don't remember if it mattered or not what rectangles I used; maybe somebody else knows offhand.

--Andy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >How to add NSScrollView automatically? (From: Michael Becker <email@hidden>)

  • Prev by Date: Re: Passing C Style Function Callbacks in Cocoa
  • Next by Date: Re: Crash in [[NSString alloc] initWithCString:msg]
  • Previous by thread: How to add NSScrollView automatically?
  • Next by thread: NSPopUpButtonCell in a Tableview not getting focus
  • Index(es):
    • Date
    • Thread