TIP 563: Scrollwheel on Horizontal Scrollbar Scrolls Without Shift too

Bounty program for improvements to Tcl and certain Tcl packages.
Author:         Harald Oehlmann <[email protected]>
State:          Final
Type:           Project
Vote:           Done
Created:        02-Feb-2020
Keywords:       Tk, bindings
Tcl-Version:    8.7
Tk-Branch:      tip-563-scrollbar-scrollwheel
Vote-Summary:	Accepted 9/0/0
Votes-For:	FV, SL, KK, JD, BG, JN, KW
Votes-Against:	none
Votes-Present:	none


Horizontal scrollbars require the shift key to be scrolled by a scroll wheel. The proposal is to scroll a horizontal scrollbar also without shift by the scroll wheel.


The widgets scrollbar and ttk::scrollbar with -orient horizontal parameter feature the same scroll wheel binding without modifier shift (which is currently a no-op) as with modifier shift.

To achieve symmetry, the same widgets, but with -orient vertical should also scroll with modifier shift (which is currently a no-op).


Scrollwheel scrolling direction within Tk is assigned as follows:

This is a very clear rule.

When the mouse pointer is over a horizontal scrollbar, the scroll wheel without shift modifier is inactive. There is never a vertical scrolling on a horizontal scrollbar.

I find it intuitive that the scroll wheel without modifier should scroll a horizontal scrollbar.

Here is some code to test:

grid [text .t -wrap none -yscrollcommand {.y set} -xscrollcommand {.x set}] -row 1 -column 1 -sticky nesw
grid [scrollbar .y -command {.t yview}] -row 1 -column 2 -sticky ns
grid [scrollbar .x -orient horizontal -command {.t xview}] -row 2 -column 1 -sticky ew
grid rowconfigure . 1 -weight 1
grid columnconfigure . 1 -weight 1
.t insert end [string repeat [string repeat 1 100]\n 100]


Implementation is in branch tip-563-scrollbar-scrollwheel.


See this ticket with a couple of discussion how this is solved over platforms and programs: https://core.tcl-lang.org/tk/tktview?name=2b8fa6fd91


This document has been placed in the public domain.