TIP 591: Rotate ttk::notebook window with mousewheel on tab

Author:         Harald Oehlmann <[email protected]>
State:          Final
Type:           Project
Vote:           Done
Created:        13-Nov-2020
Keywords:       Tk, bindings
Tcl-Version:    8.7
Tk-Branch:      tip-591
Vote-Summary:	Accepted 5/0/0
Votes-For:	JN, FV, KW, MC, SL
Votes-Against:	none
Votes-Present:	none


It is proposed that each mouse wheel tick executed on a notebook tab area will show the previous or next window.


If the mouse pointer is over the tab area of a ttk::notepad:

This should happen for vertical and horizontal mousewheel operation, like in the scrollbar. The horizontal mousewheel is bound to Shift-Mousewheel. Some special mices invoke this bining directly by a tiltable scrollwheel.


I have seen that somewhere and I find it very handy. Try it out:

ttk::bindMouseWheel TNotebook { ttk::notebook::CycleTab %W }
pack [ttk::notebook .n]
for {set index 1} {$index < 10} {incr index} {
    ttk::label .n.$index -text "Page $index"
    .n add .n.$index -text "tab $index"

This works for me on Tk 8.6.10 on Windows.

For me, this is very handy and intuitive.

Reference Implementation

Csaba provided the line:

ttk::bindMouseWheel TNotebook { ttk::notebook::CycleTab %W }

which activates this functionality.

There is a Tk branch, tip591, including this functionality.


This document has been placed in the public domain.