tk - checkbuttons abfragen?
am 18.03.2006 15:11:21 von Gerhard Wolf
Hallo,
ich habe folgendes Tk Menü mit Checkbuttons:
....
....
$RegExpr_Modifier = $frame2->Menubutton(-text => 'Schalter',
-font => $font,
)->pack(-side => 'left');
@modifier = ("a",
"b",
"c",
"dl",
"e",
"f");
foreach (@modifier) {
$cbs{$_} = $RegExpr_Modifier->checkbutton(-label => $_,
-font => $font);
}
....
....
wie kann ich abfragen welche gesetzt sind?
Re: tk - checkbuttons abfragen?
am 18.03.2006 16:48:17 von Ch Lamprecht
Gerhard Wolf schrieb:
> Hallo,
>
> ich habe folgendes Tk Menü mit Checkbuttons:
>
> ....
> ....
> $RegExpr_Modifier = $frame2->Menubutton(-text => 'Schalter',
> -font => $font,
>
> )->pack(-side => 'left');
> @modifier = ("a",
> "b",
> "c",
> "dl",
> "e",
> "f");
>
> foreach (@modifier) {
> $cbs{$_} = $RegExpr_Modifier->checkbutton(-label => $_,
> -font => $font);
> }
> ....
> ....
>
> wie kann ich abfragen welche gesetzt sind?
Hallo,
z.B. so:
$cbs{$_} = $RegExpr_Modifier->checkbutton
( -label => $_,
-command => sub {print Dumper \%values},
-variable => \($values{$_}||=0),
# -onvalue => 'foo',
# -offvalue => 'bar',
);
perldoc Tk::Checkbutton
Grüße, Christoph
--
perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"