diff options
author | jan.nijtmans <jan.nijtmans@noemail.net> | 2016-01-08 15:35:09 (GMT) |
---|---|---|
committer | jan.nijtmans <jan.nijtmans@noemail.net> | 2016-01-08 15:35:09 (GMT) |
commit | 020ffcf6fb7302e7efbe00541c3b7959864060db (patch) | |
tree | 189a03017ec5e245ff47dbed4fb4aa3c21653f1c | |
parent | 44c8cf885bbaaffb3a2c5fc449c4f57ec7dbda15 (diff) | |
parent | 3be6445701ce2055ee22cbff1e77c149d98d82e6 (diff) | |
download | tk-020ffcf6fb7302e7efbe00541c3b7959864060db.zip tk-020ffcf6fb7302e7efbe00541c3b7959864060db.tar.gz tk-020ffcf6fb7302e7efbe00541c3b7959864060db.tar.bz2 |
New attempt at fixing bug [1927212fff]. (rebased against Tk 8.6)
FossilOrigin-Name: 2da58a51068b9982f29786e481ccf3ab69560c41
-rw-r--r-- | library/scrlbar.tcl | 3 | ||||
-rw-r--r-- | tests/scrollbar.test | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index e17442f..7b1c3af 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -152,6 +152,9 @@ switch [tk windowingsystem] { } } "x11" { + bind Scrollbar <MouseWheel> { + tk::ScrollByUnits %W v [expr {- (%D/120)}] + } bind Scrollbar <4> {tk::ScrollByUnits %W v -5} bind Scrollbar <5> {tk::ScrollByUnits %W v 5} bind Scrollbar <Shift-4> {tk::ScrollByUnits %W h -5} diff --git a/tests/scrollbar.test b/tests/scrollbar.test index c6a5a90..8f92c93 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -632,6 +632,21 @@ test scrollbar-9.1 {scrollbar widget vs hidden commands} { list [winfo children .] [interp hidden] } [list {} $l] +test scrollbar-10.1 {<MouseWheel> event on scrollbar} -constraints win -setup { + destroy .t .s +} -body { + pack [text .t -yscrollcommand {.s set}] -side left + for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} + pack [scrollbar .s -command {.t yview}] -fill y -expand 1 -side left + update + focus -force .s + event generate .s <MouseWheel> -delta -120 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {2.0} + catch {destroy .s} catch {destroy .t} |