Re: pagingEnabled on NSScrollView?
Re: pagingEnabled on NSScrollView?
- Subject: Re: pagingEnabled on NSScrollView?
- From: Quincey Morris <email@hidden>
- Date: Sat, 18 Jun 2011 00:20:22 -0700
On Jun 17, 2011, at 04:04, Leonardo wrote:
> within the scrollToPageNum: I programmatically scroll the clipView to the
> X point = 100.
> [mDocView scrollPoint:newPoint];
> [self reflectScrolledClipView:mClipView];
> [self display];
>
> Now I can see the page well positioned at X = 100
> Also, if I check with
> NSLog(@"scrollToPage %@", NSStringFromPoint([mClipView bounds].origin));
> everything looks ok. I get X = 100;
>
> Now If a drag again on the trackpad, the clipView moves suddenly to the X=50
> then I can drag the page. Wrong! When setHasHorizontalScroller:YES the error
> doesn't occur.
>
> What do I miss?
I don't know, but there are some strange things in the above code.
Why are you calling 'reflectScrolledClipView:'? It shouldn't be necessary.
Why are you calling 'display'? That seems wrong -- you should be calling 'setNeedsDisplay:' instead. Or, more likely, not calling either of them.
Also, it looks like you're trying to do this without monitoring the clip view bounds- and frame-changed notifications. That's likely a problem because you're not entirely in control of the behavior of the clip view. Its relationship with the document view can change at any time, so your code isn't really working with full information. What you *tell* it to do isn't necessarily what it does, so it's better if you monitor what it actually did.
Note that if the horizontal scroll bar is enabled and is set to auto-hide, there may be multiple bounds/frame changes in the clip view after a single scroll ends.
Also note that your code may or may not be compatible with the NSClipView option "copiesOnScroll".
_______________________________________________
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