Index: library/ttk/notebook.tcl ================================================================== --- library/ttk/notebook.tcl +++ library/ttk/notebook.tcl @@ -14,10 +14,12 @@ catch { bind TNotebook { ttk::notebook::CycleTab %W -1; break } } bind TNotebook { ttk::notebook::Cleanup %W } +ttk::bindMouseWheel TNotebook [list ttk::notebook::CycleTab %W] + # ActivateTab $nb $tab -- # Select the specified tab and set focus. # # Desired behavior: # + take focus when reselecting the currently-selected tab; @@ -54,16 +56,20 @@ } # CycleTab -- # Select the next/previous tab in the list. # -proc ttk::notebook::CycleTab {w dir} { +proc ttk::notebook::CycleTab {w dir {factor 1.0}} { if {[$w index end] != 0} { set current [$w index current] - set select [expr {($current + $dir) % [$w index end]}] - while {[$w tab $select -state] != "normal" && ($select != $current)} { - set select [expr {($select + $dir) % [$w index end]}] + set d [expr {$dir/$factor}] + set d [expr {int($d > 0 ? ceil($d) : floor($d))}] + set tabCount [$w index end] + set select [expr {($current + $d) % $tabCount}] + set step [expr {$dir > 0 ? 1 : -1}] + while {[$w tab $select -state] ne "normal" && ($select != $current)} { + set select [expr {($select + $step) % $tabCount}] } if {$select != $current} { ActivateTab $w $select } }