Tk Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 1875c1f30f2d17230a3d6e8fc7c85d244e80b922
Title: mac os x: scrollbar dragging
Type: Bug Version: 8.6.7
Submitter: bll Created on: 2017-09-02 19:50:32
Subsystem: 16. [scrollbar] Assigned To: kevin_walzer
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2018-08-19 17:13:23
Resolution: Fixed Closed By: fvogel
    Closed on: 2018-08-19 17:13:23
I thought this had been fixed (can't find the ticket).

There is a disconnect between the scrollbar's drag bar and the mouse position.

To grab the scrollbar, the mouse pointer has to be positioned below the scrollbar's drag bar in order to grab it.
User Comments: fvogel added on 2018-08-19 17:13:23:
For the record: unfortunately this fix does not make the 18 currently failing (on macOS) scrollbar* tests to magically pass.

kevin_walzer added on 2018-08-12 15:00:38:
Fix committed to trunk and core-8-6-branch.

bll added on 2018-08-11 16:24:33:
The combobox test with a height of 3 doesn't work well -- it is difficult
to tell exactly what the issues are when the scrollbar handle is that small.

I changed the -height to 5 in the test script.
It is much better.

With a -height of 5 in the test script, it still seems that the very 
top and very bottom of the handle will not allow a grab.

With a -height of 3 in the test, this translates to being
extremely difficult to grab the handle.

With a -height of 10 in the test, the scrollbar handle is a good size 
and it works very well.  I cannot duplicate any issues in this case.

So in any situation where the handle is sized very small due to height
vs. number of rows in the scroll area, it will still be an issue.  


/Users/bll/tcl/tk/unix/../macosx/tkMacOSXScrlbr.c:71:10: warning: excess
      elements in scalar initializer
    {15, 54, 26, 14, 14, kControlSizeNormal}, /* kThemeScrollBarMedium */
/Users/bll/tcl/tk/unix/../macosx/tkMacOSXScrlbr.c:229:9: warning: unused
      variable 'variant' [-Wunused-variable]
    int variant, fieldLength;
/Users/bll/tcl/tk/unix/../macosx/tkMacOSXScrlbr.c:451:9: warning: unused
      variable 'variant' [-Wunused-variable]
    int variant;
3 warnings generated.

kevin_walzer added on 2018-08-11 14:49:25:
Just committed branch mac-scrollbar-fix that seems to address the issue. Please test.

kevin_walzer added on 2018-08-11 12:01:13:
I see some weirdness with the scrolling behavior now; I will take a closer look and see if a fix is possible.

fvogel added on 2018-08-11 07:41:53:
Also note that on macOS there are currently 18 failing scrollbar* tests, and their obtained results seem to reflect more or less your findings. These tests do not fail on Windows in contrast.

bll added on 2018-08-11 02:57:46:
I am going to re-open this.
Rather than the top of the scrollbar having issues, the bottom currently 
has issues.
Using the combobox example, 

package require Tk

ttk::combobox .b -values [list a b c d e f g h i j k l m n o p q r s t u v w] -height 3 -state readonly
.b set a
pack .b

I have to position the cursor below the handle in order to grab it and make it
move.   I have to click well below the handle in order to execute a page-down
action.  The top of the scrollbar does not seem to have any issues at this time.

I can put the cursor in the trough and pull down and the handle moves, and my 
cursor will end up entirely outside the window.

Once the handle have been moved down, grabbing it to move it up is not much
of an issue.

kevin_walzer added on 2018-07-31 12:37:29:
Closing because previously fixed (reported on mailing list, can't find date at this time).

kevin_walzer added on 2017-09-03 17:06:38:
Sorry, I still don't really see the issue here. 

On the combobox, if the scrollbar is dragged right in the middle, it does not move; if you move the mouse up or down a little bit to the upper or lower edge, it scrolls as expected. 

On the demo, I did not run the test for the text sample, but the canvas example also has horizontal scrolling. There, if you click the mouse outside the scrollbar, it jumps right or left--this is expected and documented behavior. If you click the mouse at either edge, it scrolls as expected. 

In revising the scrollbar implementation, I replaced the Cocoa metrics that were causing extremely buggy behavior with the Unix metrics, which resulted in substantial improvement. It still may not be perfect; you may have hit an edge case where things are still a bit wonky. But user reports based on the last round of fixes confirm that the scrolling is working a lot better and as expected for the vast majority of circumstances. Therefore, I'm going to say there's not much more that can be done here.

bll added on 2017-09-03 13:16:15:
I forgot to mention...ttk::combobox uses 'scrollbar', not 'ttk::scrollbar', but I think they are identical.  Changing ttk::combobox to use ttk::scrollbar has no effect.

bll added on 2017-09-03 12:54:00:
In the demos, if I use the 'text widget with embedded windows' and turn on horizontal scrolling, I cannot grab the scrollbar at the very far left.

Similarly for the vertical scrollbar, I cannot grab it at the very top.  Though as this scrollbar is a larger percentage of the screen, it is harder to demonstrate.

package require Tk

ttk::combobox .b -values [list a b c d e f g h i j k l m n o p q r s t u v w] -height 3 -state readonly
.b set a
pack .b

kevin_walzer added on 2017-09-02 20:44:50:
I'm not sure I ever opened a ticket for it; the bug was reported on one of the mailing lists. I did a commit earlier this year that did fix it. 

Running the demo that comes with Wish, I cannot reproduce this now. Dragging the scrollbar from the top moves it up as expected. 

Can you provide a sample script that reproduces the issue?