Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bind <MouseWheel> on unix?

54 views
Skip to first unread message

Dave

unread,
Mar 10, 2017, 12:22:07 AM3/10/17
to
What am I missing?

Running Ubuntu with ActiveState's Tcl 8.6.6 under VirtualBox on a
Win7x64 system:

% frame .f -width 300 -height 300
% pack .f
% bind .f <MouseWheel> { puts "<MouseWheel> %W" }
% bind .f <Button-1> { puts "<Button-1> %W" }

Clicking button 1 I get:

<Button-1> .f

Mouse wheel gives me nothing.

On Win7x64, I get:

<MouseWheel> .f

How can I bind <MouseWheel> on unix?

--
computerjock AT mail DOT com

Christian Gollwitzer

unread,
Mar 10, 2017, 12:32:07 AM3/10/17
to
Am 10.03.17 um 06:22 schrieb Dave:
MouseWheel on Unix maps to the mouse buttons <4> and <5>. So in addition
to MouseWheel bind to those buttons.

Christian

Dave

unread,
Mar 10, 2017, 1:18:50 AM3/10/17
to
On 3/9/2017 11:32 PM, Christian Gollwitzer wrote:

>
> MouseWheel on Unix maps to the mouse buttons <4> and <5>. So in addition
> to MouseWheel bind to those buttons.
>
> Christian

Thank you. I was just about to reply to my own question with the answer
I finally found in this rather old discussion:
http://wiki.tcl.tk/3893

If that info is in the documentation, I missed it. If it's not, then it
should be added.

I put this at the beginning of my script... it seems to do the trick.

if { ! $isWindows } {
bind all <Button-4> {
event generate %W <MouseWheel> -delta 120
}
bind all <Button-5> {
event generate %W <MouseWheel> -delta -120
}
}

It seems quite strange to me that, while Tk emulates X11 behavior on
windows, Tk does not emulate <MouseWheel> on unix. How many years has it
been since mice with wheels were introduced?

Harald Oehlmann

unread,
Mar 13, 2017, 5:22:08 AM3/13/17
to
For me, this is a reasonable improvement.
Do you like to post at least a RFE ticket on core.tcl.tk/tk (login as
anonymous if you have no login).

Thanks,
Harald

Dave

unread,
Mar 13, 2017, 12:02:23 PM3/13/17
to
On 3/13/2017 4:21 AM, Harald Oehlmann wrote:
> For me, this is a reasonable improvement.
> Do you like to post at least a RFE ticket on core.tcl.tk/tk (login as
> anonymous if you have no login).
Done
0 new messages