Leser: 2
![]() |
|< 1 2 >| | ![]() |
19 Einträge, 2 Seiten |
ptk+2007-09-11 21:32:33--Ach, falscher Aufruf. Versuch mal stattdessen.Code: (dl )$mw->MouseWheelBind("Tk::Canvas")
Alternativ auch nur "Canvas" oder "canvas".
$mw->bind($c, '<MouseWheel>', sub { print "Test\n"; });
Gast+2007-09-12 09:11:10--ptk+2007-09-11 21:32:33--Ach, falscher Aufruf. Versuch mal stattdessen.Code: (dl )$mw->MouseWheelBind("Tk::Canvas")
Alternativ auch nur "Canvas" oder "canvas".
ich gebs auf :(
Es geht leider nicht. Selbst hier:
Code (perl): (dl )$mw->bind($c, '<MouseWheel>', sub { print "Test\n"; });
gehts nicht. Keine Reaktion...
Ich vermute mal das liegt an Maustreiber. Es gibt hier so einige Programme, wo bei bestimmten Widgets Scrollen einfach nicht funktioniert. Bspw. VBA-Editor von M$. Da kann man auch nichts machen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new; my $c = $mw->Scrolled( qw/Canvas -width 400 -height 400 -relief sunken -bg white -borderwidth 1 -scrollbars se -scrollregion/ => [qw/0 0 1000 1000/])->pack; $mw->bind($mw, '<MouseWheel>', [sub { my $unit = $_[1] > 0 ? -1 : 1; $c->yviewScroll($unit => 'units'); }, Ev('D')] ); MainLoop;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use warnings;
use strict;
use Tk;
my $mw = MainWindow->new;
my $e = $mw->Entry ->pack;
my $c = $mw->Scrolled(
qw/Canvas
-width 400 -height 400 -relief sunken
-bg white -borderwidth 1 -scrollbars se -scrollregion/ =>
[qw/0 0 1000 1000/])->pack;
my $ic = $c->Subwidget('scrolled');
$mw->MouseWheelBind($ic);
$ic->Tk::bind('<1>',[$ic,'Tk::focus']);
MainLoop;
1
2
3
4
5
use Tk;
$top = new MainWindow;
$top->Scrolled("Listbox")->pack->insert("end", keys %ENV);
$top->Scrolled("Listbox")->pack->insert("end", keys %INC);
MainLoop;
$ic->Tk::bind('<1>',[$ic,'Tk::focus']);
1
2
3
14: $mw->bind($mw, '<MouseWheel>',
15: [sub { my $unit = $_[1] > 0 ? -1 : 1; $c->yviewScroll($unit => 'units'); }, Ev('D')]
16: );
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use Tk;
my $top = new MainWindow;
$top->Scrolled("Listbox")->pack->insert("end", keys %ENV);
$top->Scrolled("Listbox")->pack->insert("end", keys %INC);
my $c = $top->Scrolled( qw/Canvas
-width 400 -height 400 -relief sunken
-bg white -borderwidth 1 -scrollbars se -scrollregion/ =>
[qw/0 0 1000 1000/])->pack;
$top->bind($top, '<MouseWheel>',
[sub { my $unit = $_[1] > 0 ? -1 : 1;
$c->yviewScroll($unit => 'units')
},
Ev('D')]
);
MainLoop;
1
2
3
4
5
6
7
8
9
10
11
use Tk;
my $top = new MainWindow;
$top->Scrolled("Listbox")->pack->insert("end", keys %ENV);
$top->Scrolled("Listbox")->pack->insert("end", keys %INC);
my $c = $top->Scrolled( qw/Canvas
-width 400 -height 400 -relief sunken
-bg white -borderwidth 1 -scrollbars se -scrollregion/ =>
[qw/0 0 1000 1000/])->pack;
my $ic = $c->Subwidget('scrolled');
$top->MouseWheelBind($ic);
MainLoop;
![]() |
|< 1 2 >| | ![]() |
19 Einträge, 2 Seiten |