How to differentiate between scrollbar click events and scrollbar drag events?

Posted by Sameer on Stack Overflow See other posts from Stack Overflow or by Sameer
Published on 2010-04-16T07:01:34Z Indexed on 2010/04/16 7:03 UTC
Read the original article Hit count: 311

Filed under:
|
|
|
|

I need to scroll an EXT-GWT grid by some custom amount instead of the default 1-2 rows. Since I couldn't find any parameter that let me do this, I overrode the event handler to capture scroll or mousewheel events. On any such event, I just programmatically move the scroller further by the required amount in the same direction, keeping a flag to ensure that it doesn't go into an infinite loop.

However, this technique fails when the user scrolls the grid with the scroller. Specifically, when I drag the scroller from some position to the top of the scroll track, the rows displayed in the grid are not the topmost rows in the grid but some rows further down. I figured that if I could differentiate between the events generated by the scroll-up and scroll-down buttons and those generated by scroller drag, I could handle them separately and rectify the issue.

Any way this could be done? Or is there a way to specify the amount by which a scrollbar should scroll in one step?

Thanks
-Sameer

© Stack Overflow or respective owner

Related posts about ext-gwt

Related posts about scrollbar