Thread Mausrad an Textwidget binden: Wie heißt der Modifier? (7 answers)
Opened by Crian at 2004-12-16 12:47

esskar
 2004-12-16 14:17
#42682 #42682
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
sub BindMouseWheel {
my ($w) = @_;
if ($^O eq "MSWin32")
{
$w->bind('<MouseWheel>' => [ sub { $_[0]->yview('scroll', -($_[1]/120)*3, 'units') }, Ev('D') ] );
}
else
{
# Support for mousewheels on Linux commonly comes through
# mapping the wheel to buttons 4 and 5. If you have a
# mousewheel ensure that the mouse protocol is set to
# "IMPS/2" in your /etc/X11/XF86Config (or XF86Config-4)
# file:
# Select "InputDevice"
# Identifier "Mouse0"
# Driver "mouse"
# Option "Device" "/dev/mouse"
# Option "Protocol" "IMPS/2"
# Option "Emulate3Buttons" "off"
# Option "ZAxisMapping" "4 5"
# EndSection
$w->bind('<4>', => sub {
$_[0]->yview('scroll', -3, 'units') unless $Tk::strictMotif;
});
$w->bind('<5>' => sub {
$_[0]->yview('scroll', +3, 'units') unless $Tk::strictMotif;
});
}
}

View full thread Mausrad an Textwidget binden: Wie heißt der Modifier?