• 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
NSScrollView jumping to previous scroll when using scroll wheel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSScrollView jumping to previous scroll when using scroll wheel


  • Subject: NSScrollView jumping to previous scroll when using scroll wheel
  • From: Chilton Webb <email@hidden>
  • Date: Mon, 7 Jan 2008 09:27:33 -0600

Hi,

I suspect this is a matter of just missing some particular method call, but I'm out of ideas.

I set up an NSScrollView object in IB containing a custom NSView. I want to programmatically scroll it horizontally back and forth. I can do this just fine (see code below), and I can scroll it using the scroll wheel just fine. But if I programmatically scroll it, and then use the scroll wheel, the scroll 'jumps' back to the place where I left off scrolling with the scroll wheel earlier.

If I show the scroll view's horizontal scroll bar using [[self enclosingScrollView] setHasHorizontalScroller:YES]; , the location of the scroll I set programmatically is preserved, and everything works beautifully. If I set that to NO, which is the desired setting, the jumping occurs. How can I make it not jump?

Here's my code.

- (void) scrollIt
{
	NSScrollView *scrollView = [self enclosingScrollView];
	NSPoint currentScrollPosition=[[scrollView contentView] bounds].origin;
	NSLog(@"Before: %@", NSStringFromPoint(currentScrollPosition));

// _scroll is an NSPoint that we set earlier, based on the current scroll plus our desired offset.
[[scrollView documentView] scrollPoint:_scroll];


// Turning this to YES or NO will deactivate or activate the bug
[[self enclosingScrollView] setHasHorizontalScroller:YES];

// This line verifies that the bug exists, and that we are actually jumping to the coordinates we scrolled
// to when we last used the scroll wheel
NSLog(@"After: %@", NSStringFromPoint([[[self enclosingScrollView] contentView] bounds].origin));



// These were suggested, but didn't help
// [scrollView setHorizontalLineScroll:delta];
// [scrollView reflectScrolledClipView:[scrollView documentView]]; // didn't help
// [scrollView reflectScrolledClipView:[scrollView contentView]]; // didn't help
// [scrollView reflectScrolledClipView]; // didn't help


}


Again, just having the scroller exist or not exist will toggle the bug. Is there something I'm missing?


Thank you,
-Chilton


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Prev by Date: Re: Circular initialization of controllers in NIB file
  • Next by Date: Re: Open record in Address Book
  • Previous by thread: How do I make the Downloads stack bounce?
  • Next by thread: QTCaptureView retain count problem and setting iSight's focus (macro)
  • Index(es):
    • Date
    • Thread