Thread Ausgewählte Elemente in Liste verpacken (7 answers)
Opened by Nera89 at 2008-06-29 15:10

Gast Gast
 2008-06-29 18:03
#111657 #111657
Ein Beispiel:
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl

use strict;
use warnings;

use Tk;

my $mw = tkinit();

my @check;

foreach my $value ( 1 .. 10 )
{
my $col = $value <= 5 ? $value : $value - 5;
my $row = $value > 5 ? 1 : 0;

$mw->Checkbutton(
-text => $value,
-onvalue => $value,
-variable => \$check[$value-1],
)->grid(
-column => $col,
-row => $row,
);
} # foreach

$mw->Button(
-text => 'OK',
-command => sub {
print 'Ausgewaehlt: ', join ', ', grep { $_ } @check, "\n";
},
)->grid(
-column => 0,
-columnspan => 4,
-row => 2,
-sticky => 'ew',
);

$mw->gridRowconfigure( 2, -weight => 1 );

MainLoop;

__END__

MfG

View full thread Ausgewählte Elemente in Liste verpacken