diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-25 09:21:04 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-25 09:21:04 (GMT) |
commit | 806e7862d404cf9f85f85ff6d4b3e74eb09317f6 (patch) | |
tree | 706882fe6334e9de5f11cf853a8b3b69b63b4f3f /library/ttk/combobox.tcl | |
parent | aa8237ea926f3a1b19e4501879e6d32f6e0b7e6c (diff) | |
download | tk-806e7862d404cf9f85f85ff6d4b3e74eb09317f6.zip tk-806e7862d404cf9f85f85ff6d4b3e74eb09317f6.tar.gz tk-806e7862d404cf9f85f85ff6d4b3e74eb09317f6.tar.bz2 |
New utility function ::tk::MouseWheel
Diffstat (limited to 'library/ttk/combobox.tcl')
-rw-r--r-- | library/ttk/combobox.tcl | 8 |
1 files changed, 6 insertions, 2 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 } |