The actual implementation used for TIP 171 was completely different from the
one in the TIP text. The main problem addressed by the TIP was the fact that
on Windows, the mousewheel scrolls the focus widget (instead of the widget
under the mouse pointer). At Tcl level, this could only be partly remedied by
the complex (and not always working) bindings described in the TIP. Therefore,
the focus problem was instead solved by a much simpler patch at the C level.
The [bind all <MouseWheel>] binding in the TIP text was not included, because
it was not necessary anymore. You can easily add such bindings yourself now,
if you want.
> There are funny interactions:
> when having a BWidget NoteBook widget with a client with a scrollbar
> and I klick on a NoteBook tab and I use the scrollwhell, The whole
> Notebook is scrolled out and gray place is shown below.
>
> I suppose that the canvas within the Notebook implementation sets the
> scrolling region to a higher value and thus, the Canvas is scrolled.
>
> Inside the NoteBook, I have a BWidget ScrolledWindow environment.
> This widget is not scrolled by the mousewheel.
> But if the mouse is over the Scrollbar of the ScrolledWindw, the
> scrolled window is scrolled now (without click).
> This did not work before.
>
> Does anybody have looked to those issues ?
>
> When starting BWidget under TCL8.6, this misbehaviour will show-up,
> right ?
No. You won't notice much difference. If you want to use generic MouseWheel
bindings in 8.6, you still have to add something like the following:
proc MouseWheel {w D X Y} {
# Search upward for widget which can perform yview
# (and do not scroll canvas with undefined scrollregion)
for {} {[winfo toplevel $w] ne $w} {set w [winfo parent $w]} {
if {![catch {$w cget -scrollregion} sr] && $sr eq ""} {continue}
if {![catch {$w yview scroll [expr {-$D/30}] units}]} {break}
}
}
foreach class {Text Listbox} {
bind $class <MouseWheel> {}
if {[tk windowingsystem] eq "x11"} {
bind $class <4> {}
bind $class <5> {}
}
}
bind all <MouseWheel> {MouseWheel %W %D %X %Y}
if {[tk windowingsystem] eq "x11"} {
bind all <4> {MouseWheel %W 120 %X %Y}
bind all <5> {MouseWheel %W -120 %X %Y}
}
Regards,
Koen