Leser: 1
8 Einträge, 1 Seite |
1
2
3
4
5
6
$mw->bind('<Up>', sub { $Config{text_widget}->yviewScroll(-1, 'units') } );
$mw->bind('<Down>', sub { $Config{text_widget}->yviewScroll( 1, 'units') } );
$mw->bind('<Alt-Up>', sub { $Config{text_widget}->yviewScroll(-3, 'units') } );
$mw->bind('<Alt-Down>', sub { $Config{text_widget}->yviewScroll( 3, 'units') } );
$mw->bind('<Control-Prior>', sub { $Config{text_widget}->yviewScroll(-1, 'pages') } );
$mw->bind('<Control-Next>', sub { $Config{text_widget}->yviewScroll( 1, 'pages') } );
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use Tk;
# Experimental mousewheel support. This should really be part of Tk.
# XXX <MouseWheel> support for Windows is untested.
BEGIN {
if ($Tk::VERSION < 804) {
local $^W = 0;
require Tk::Listbox;
my $orig_tk_listbox_classinit = \&Tk::Listbox::ClassInit;
*Tk::Listbox::ClassInit = sub {
my($class,$mw)=@_;
$orig_tk_listbox_classinit->(@_);
$mw->bind($class, "<4>", ['yview', 'scroll', -5, 'units']);
$mw->bind($class, "<5>", ['yview', 'scroll', +5, 'units']);
$mw->bind($class, '<MouseWheel>',
[ sub { $_[0]->yview('scroll',-($_[1]/120)*3,'units') }, Tk::Ev("D")]);
};
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;
});
}
}
$mw->bind('<MouseWheel>', [ sub { $Config{text_widget}->yviewScroll(-($_[1]/120)*3, 'units') }, Ev('D') ] );
8 Einträge, 1 Seite |