summaryrefslogtreecommitdiffstats
path: root/library/ttk
diff options
context:
space:
mode:
Diffstat (limited to 'library/ttk')
-rw-r--r--library/ttk/combobox.tcl8
-rw-r--r--library/ttk/spinbox.tcl6
-rw-r--r--library/ttk/utils.tcl12
3 files changed, 15 insertions, 11 deletions
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 0a7e519..c72d02e 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -182,11 +182,15 @@ proc ttk::combobox::SelectEntry {cb index} {
## Scroll -- Mousewheel binding
#
-proc ttk::combobox::Scroll {cb dir} {
+proc ttk::combobox::Scroll {cb dir {factor 1.0}} {
$cb instate disabled { return }
set max [llength [$cb cget -values]]
set current [$cb current]
- incr current $dir
+ set d [expr {round($dir/factor)}]
+ if {$d == 0 && $dir != 0} {
+ if {$dir > 0} {set d 1} else {set d -1}
+ }
+ incr current $d
if {$max != 0 && $current == $current % $max} {
SelectEntry $cb $current
}
diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl
index 33936d9..19a330f 100644
--- a/library/ttk/spinbox.tcl
+++ b/library/ttk/spinbox.tcl
@@ -82,11 +82,11 @@ proc ttk::spinbox::Release {w} {
# Mousewheel callback. Turn these into <<Increment>> (-1, up)
# or <<Decrement> (+1, down) events.
#
-proc ttk::spinbox::MouseWheel {w dir} {
+proc ttk::spinbox::MouseWheel {w dir {factor 1}} {
if {[$w instate disabled]} { return }
- if {$dir < 0} {
+ if {($dir < 0) ^ ($factor < 0)} {
event generate $w <<Increment>>
- } else {
+ } elseif {$dir > 0} {
event generate $w <<Decrement>>
}
}
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index c58d39e..de7565c 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -285,8 +285,8 @@ proc ttk::copyBindings {from to} {
#
proc ttk::bindMouseWheel {bindtag callback} {
- bind $bindtag <MouseWheel> [append callback { [expr {%D/-120.0}]}]
- bind $bindtag <Option-MouseWheel> [append callback { [expr {%D/-12.0}]}]
+ bind $bindtag <MouseWheel> [append callback { %D -120.0}]
+ bind $bindtag <Option-MouseWheel> [append callback { %D -12.0}]
}
## Mousewheel bindings for standard scrollable widgets.
@@ -298,12 +298,12 @@ proc ttk::bindMouseWheel {bindtag callback} {
#
bind TtkScrollable <MouseWheel> \
- { %W yview scroll [expr {%D/-120.0}] units }
+ { tk::MouseWheel %W y %D -120.0 }
bind TtkScrollable <Option-MouseWheel> \
- { %W yview scroll [expr {%D/-12.0}] units }
+ { tk::MouseWheel %W y %D -12.0 }
bind TtkScrollable <Shift-MouseWheel> \
- { %W xview scroll [expr {%D/-120.0}] units }
+ { tk::MouseWheel %W x %D -120.0 }
bind TtkScrollable <Shift-Option-MouseWheel> \
- { %W xview scroll [expr {%D/-12.0}] units }
+ { tk::MouseWheel %W x %D -120.0 }
#*EOF*