Community
Participate
Working Groups
Please launch the attached snippet on Linux and use the mouse wheel to scroll. In the left Canvas scrolling appears to be much slower (sometimes one mouse wheel step does not result in any scrolling at all) then in the right Table (often one mouse wheel step results in 2 scrolled rows).
Created attachment 283811 [details] Snippet to reproduce
Created attachment 283812 [details] After scrolling 2 steps
Created attachment 283813 [details] Snippet with large scroll steps in Canvas
In the "Snippet with large scroll steps in Canvas" it scrolls 9 rows (Canvas) vs. 2 (Table) per mouse wheel step.
Hello, I have tested the snippets and reproduce the same results. However, I'm not sure what the problem is here. Since the canvas scrollbar is having custom values set, it will be different than the Table scroll speed.
(In reply to Soraphol (Paul) Damrongpiriyapong from comment #5) > Since the canvas scrollbar is having > custom values set, it will be different than the Table scroll speed. Try to implement a table-like control (which we did because Table was too slow on some platforms to handle large amounts of data). The user will expect to see the same scroll effect on a Table or custom control. On Windows it works as expected, but not on Linux.
I found that GTK table behaves the following way (in GTK terms): 1) Scrolling speed is calculated from verticalBar.setThumb() 2) GTK's Table passes Table height to verticalBar.setThumb() 3) The final formula is for pixels scrolled per wheel step: min(tableHeight/2, pow(tableHeight, 2/3)) Note that on Windows, scrolling speed does not depend on tableHeight. So in order to mimic the behavior of GTK, one should do the following: 1) Set max of verticalBar to total pixel height of contents 2) verticalBar.setThumb(canvas.getSize().y) 3) Consider 'verticalBar.getSelection()' to be measured in pixels. Note that measuring in anything but pixels is hard because GTK uses pow(,2/3) and SWT discards fractional part of 'verticalBar.getSelection()'. References in GTK code: * get_scroll_unit() in gtkscrolledwindow.c * gtk_adjustment_configure() in gtk_tree_view_size_allocate()