Leser: 3
|< 1 2 >| | 12 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/Perl/bin/perl
use strict;
use warnings;
use Tk;
use Tk::Listbox;
my $mw = Tk::MainWindow->new(-width => 400, -height => 400,);
$mw->packPropagate(0);
my @werte = qw(1 2 3 4 5 6);
my $listbox = $mw->Scrolled('Listbox',
-scrollbars => 'e',
-height => 5,
-listvariable => \@werte,
)->pack(-side => 'left', -fill => 'y',);
my $label = $mw->Label(-text => 'click a listbox-value', -bg => 'green',)->pack(-fill => 'x',);
$listbox->bind('<<ListboxSelect>>', sub{ $label->configure(-text => $listbox->get($listbox->curselection()),); },);
$mw->MainLoop();
1 2 3 4 5 6 7 8 9
$textfield_listing->bind('<<ListboxSelect>>', sub { if ($textfield_listing->curselection()) { $button_stop->configure( -state => "normal"); $button_log->configure( -state => "normal"); $button_info->configure( -state => "normal"); } # ein ListboxDeselect wäre nice, hab aber nichts dazu gefunden :( } );
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$textfield_listing->bind('<<FocusIn>>', sub { if ($textfield_listing->curselection()) { $button_stop->configure( -state => "normal"); $button_log->configure( -state => "normal"); $button_info->configure( -state => "normal"); } } ); $textfield_listing->bind('<<FocusOut>>', sub { $button_stop->configure( -state => "disabled"); $button_log->configure( -state => "disabled"); $button_info->configure( -state => "disabled"); } );
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 30 31
#!/usr/bin/perl -w use strict; use Tk; my $mw = tkinit(); my @werte = qw(1 2 3 4 5 6); my $listbox = $mw->Scrolled('Listbox', -scrollbars => 'e', -height => 5, -listvariable => \@werte, -exportselection => 1,) ->pack(-side => 'left', -fill => 'y',); $listbox->bind('<<ListboxSelect>>', sub{check_state()} ); my $b1 = $mw->Button(-text => 'test')->pack; my $lb2 = $mw->Scrolled('Listbox', -scrollbars => 'e', -height => 5, -listvariable => \@werte,) ->pack(-side => 'left', -fill => 'y',); $lb2->bind('<<ListboxSelect>>', sub{check_state()}); MainLoop; sub check_state { if ($listbox->curselection()) { $b1->configure( -state => "normal"); } else { $b1->configure( -state => "disabled" ); } }
my $id = $mainwindow->repeat(15000, \&function123);
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 30 31 32 33 34
#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = new MainWindow(-title =>"Test"); my $windowheight = 360; my $windowwidth = 470; my $mframe = $mw->Frame(); my $textfield1 = $mframe->ScrlListbox(-scrollbars =>"se", -height => 10, -width => 35); my $button_start = $mframe->Button(-text =>"Start", -command=>\&start); my $button_stop = $mframe->Button(-text =>"Stop", -state => "disabled", -command=>\&stop); my $button_clear = $mframe->Button(-text =>"Clear", -command=>\&clear); my $lframe = $mw->Frame(); my $textfield2 = $lframe->ScrlListbox(-scrollbars=>"se", -height => 6, -width => 62); $mframe->grid(-row=>1, -column=>1, -rowspan=>10, -columnspan=>4); $textfield1->grid(-row=>1, -column=>1, -rowspan=>10); $button_start->grid(-row=>1, -column=>2); $button_stop->grid(-row=>2, -column=>2); $button_clear->grid(-row=>3, -column=>2); $lframe->grid(-row=>11, -column=>1, -rowspan=>2, -columnspan=>2); $textfield2->grid(-row=>1, -column=>1, -rowspan=>1, -columnspan=>1); # disable / enable check fuer stop button $textfield1->bind('<<ListboxSelect>>', sub { if ($textfield1->curselection()) { $button_stop->configure( -state => "normal"); } else { $button_stop->configure( -state => "disabled"); } } );
|< 1 2 >| | 12 Einträge, 2 Seiten |