• 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
Scrolling problem...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scrolling problem...


  • Subject: Scrolling problem...
  • From: Jeff LaMarche <email@hidden>
  • Date: Thu, 23 Jan 2003 11:47:29 -0500

I've having the darnedest time with an NSScrollView that I'm using to
display a large view.

I'm taking the contentView from an offscreen window and setting it as
the content view of the NSScrollView. When it comes up on the screen,
the horizontal scroll bar is all the way to the left, but the vertical
scroll bar is at the bottom. It needs to be at the top, so I tried
scrolling with scrollRectToVisible. Here is my code with some debugging
statements:

- (void)windowDidLoad
{

NKDInvoiceController *ctrl = [[NKDInvoiceController alloc]
initWithInvoice:[self invoice]
andProject:[self project]];
NSView *contentView = [[ctrl window] contentView];
NSLog(@"contentView: %@", contentView);
[scrollView setDocumentView:contentView];

BOOL didScroll = [scrollView scrollRectToVisible:NSMakeRect(0,
([contentView frame].size.height - 5), 5, 5)];
NSLog(@"documentView height: %f", [contentView frame].size.height);
NSLog(@"didScroll: %@", didScroll ? @"YES" : @"NO");

[ctrl release];
}

The result of this is the following:

2003-01-23 11:41:14.152 SimpleInvoicer[1754] contentView: <NSView:
0x146be60>
2003-01-23 11:41:14.155 SimpleInvoicer[1754] documentView height:
666.000000
2003-01-23 11:41:14.155 SimpleInvoicer[1754] didScroll: NO

I can't figure out why it's not working. I'm defining a rectangle in
the upper left corner and telling it to scroll until that Rect is
visible, but it's not working. I've tried a bunch of different ways to
get it to display the way I want it and nothing's working. I had
thought that maybe my origin was inverted, but I also tried with
NSMakeRect(0,0,5,5) and the results were the same. Anyone have any
thoughts on what I'm doing wrong?

TIA
Jeff
_______________________________________________
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.

  • Prev by Date: Re: Faster Scroller
  • Next by Date: dragging from NSToolbar
  • Previous by thread: Re: Green, Yellow and Red glob window buttons
  • Next by thread: Re: Scrolling problem...
  • Index(es):
    • Date
    • Thread