Smooth scrolling during NSTableView drop operation
Smooth scrolling during NSTableView drop operation
- Subject: Smooth scrolling during NSTableView drop operation
- From: cricket <email@hidden>
- Date: Sun, 9 May 2004 16:03:34 -0700
My second question for the day that I've spent the better part of the
day struggling with:
I'd like to be able to use the same smooth scrolling that already
happens when you do a vertical drag in a tableview and
verticalMotionCanBeginDrag is NO. What happens is that only when you
move outside the scrollview's bounds does scrolling occur -- and the
amount of scrolling is based on the distance outside the scrollview.
When you do the same vertical motion with verticalMotionCanBeginDrag
set to YES, the scrollview starts scrolling spastically as soon as you
get near the edge of the bounds of the scrollview.
I've overridden mouseDown: as follows and the smooth scrolling _does_
work.
- (void)mouseDown:(NSEvent *)theEvent {
BOOL stayInLoop = YES;
[NSEvent startPeriodicEventsAfterDelay:0.1 withPeriod:0.1];
while (stayInLoop) {
theEvent = [[self window]
nextEventMatchingMask:(NSLeftMouseUpMask | NSLeftMouseDraggedMask |
NSPeriodicMask)];
switch ([theEvent type]) {
case NSLeftMouseUp:
stayInLoop = NO;
break;
default:
[self autoscroll:theEvent];
}
}
[NSEvent stopPeriodicEvents];
}
For selection, I can set this up manually with
selectRow:byExtendingSelection:, but I don't quite understand how I can
get normal tableview drag and drop behavior to also work.
- cricket
---------->
The insurgency began and you missed it.
_______________________________________________
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.