Problem scrolling a clip view
Problem scrolling a clip view
- Subject: Problem scrolling a clip view
- From: email@hidden
- Date: Mon, 21 May 2007 15:43:02 +0200
I'd like to programmatically scroll my clip view in a smooth fashion.
So I tried with the code below. It works, but the clip view is not
updated until the loop finishes, eg. the whole thing equals a 100
pixel jump without scroll. I cannot see any logical reason for this.
Please help.
NSView *documentView = [[[webView mainFrame] frameView] documentView];
NSClipView *clipView = (NSClipView *)[documentView superview];
NSScrollView *scrollView = (NSScrollView *)[clipView superview];
NSPoint currentScrollPosition=[[scrollView contentView] bounds].origin;
struct timeval delay;
memset (&delay, 0, sizeof(delay) );
delay.tv_usec = 1000; // Delay in micro seconds
int i = 0;
while (i != 100) {
i = i + 1;
[clipView scrollToPoint:(NSPoint) [clipView
constrainScrollPoint:NSMakePoint(currentScrollPosition.x,
currentScrollPosition.y + i)]];
select ( 0, (fd_set*)nil, (fd_set*)nil, (fd_set*)nil, &delay);
}
_______________________________________________
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