Leser: 2
|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
my $radvar='rot';
$mw->Radiobutton(-text => 'rot', -variable=>$radvar, -value=>'rot', -anchor=>'w')->pack(-fill,'x');
$mw->Radiobutton(-text => 'gelb', -variable=>$radvar, -value=>'gelb', -anchor=>'w')->pack(-fill,'x');
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
sub hlist_notebook{
my ( $hash_ref, $hash_ref_ini, $page, $hlist, $befehl, $choices) = @_;
my ( $counter, $choices_for_browse, $choices_befehl, $feld, $feldname);
for $feldname (keys(%{$hash_ref_ini})) {
$counter++;
}
my @choices = lies_tabellen_zeilen($dbh, "adresstyp", "beschreibung");
$hlist = $page->Scrolled("HList",
-header => 1,
-columns => $counter,
-scrollbars => 'oe',
-width => 145,
-height => 20,
-relief => 'flat',
-selectbackground => 'SeaGreen3',
#-background => ''white'',
)
->$befehl();
for my $datensatz_id (sort keys(%{$hash_ref})){
my $e = $hlist->addchild("");
for $feldname (keys(%{$hash_ref_ini})) {
my $browse = $hash_ref_ini->{$feldname}->{'widget'};
$hlist->header('create', $hash_ref_ini->{$feldname}->{'place'}, -itemtype => 'window', -widget => $hlist->Button(-text => $hash_ref_ini->{$feldname}->{'buttonname'}, -relief => 'flat', -command => [ \&MyTk::HList::order, $hash_ref_ini->{$feldname}->{'place'}, 0 ]), -style => $headerstyle);
$hlist->itemCreate($e, $hash_ref_ini->{$feldname}->{'place'}, -itemtype => 'window', (-widget => $feld = $hlist->$browse($hash_ref_ini->{$feldname}->{'variable'} => \$hash_ref->{$datensatz_id}->{$feldname}, -width => $hash_ref_ini->{$feldname}->{'width'})));
if ($browse eq "BrowseEntry"){
$feld->insert('end',$_) for (@choices);
}
}
}
}#hlist_notebook
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
#!/usr/bin/perl -w
#
use strict;
use Tk;
my $mw = tkinit();
my $radio = {group1 => [qw/1 2 3 4 5 6 7 8 9/],
group2 => [qw/a b c d e f g h i/]};
foreach my$group (keys %{$radio}) {
if ($group =~ /1/) {
for my$i (0..$#{$radio->{$group}}) {
$mw->Radiobutton(-value => $radio->{$group}->[$i],
-variable => \$radio->{var1},
-text => $radio->{$group}->[$i])->pack(-anchor,"e",-side,"top");
}
}
else {
for my$i (0..$#{$radio->{$group}}) {
$mw->Radiobutton(-value => $radio->{$group}->[$i],
-variable => \$radio->{var2},
-text => $radio->{$group}->[$i])->pack(-anchor,"n",-side,"right");
}
}
}
MainLoop;
1
2
3
...
(-widget => $feld = $hlist->$browse($hash_ref_ini->{$feldname}->{'variable'} => \$hash_ref->{$datensatz_id}->{$feldname}, -width => $hash_ref_ini->{$feldname}->{'width'})
...
$hash_ref_ini->{$feldname}->{'variable'}
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
sub hlist_notebook{
my ( $hash_ref, $hash_ref_ini, $page, $hlist, $befehl, $choices) = @_;
my ( $counter, $choices_for_browse, $choices_befehl, $feld, $feldname);
for $feldname (keys(%{$hash_ref_ini})) {
$counter++;
}
my @choices = lies_tabellen_zeilen($dbh, "adresstyp", "beschreibung");
$hlist = $page->Scrolled("HList",
-header => 1,
-columns => $counter,
-scrollbars => 'oe',
-width => 145,
-height => 20,
-relief => 'flat',
-selectbackground => 'SeaGreen3',
#-background => ''white'',
)
->$befehl();
for my $datensatz_id (sort keys(%{$hash_ref})){
my $e = $hlist->addchild("");
for $feldname (keys(%{$hash_ref_ini})) {
my $browse = $hash_ref_ini->{$feldname}->{'widget'};
$hlist->header('create',
$hash_ref_ini->{$feldname}->{'place'},
-itemtype => 'window',
-widget => $hlist->Button(-text => $hash_ref_ini->{$feldname}->{'buttonname'},
-relief => 'flat',
-command => [ \&MyTk::HList::order, $hash_ref_ini->{$feldname}->{'place'}, 0 ]),
-style => $headerstyle);
$hlist->itemCreate($e,
$hash_ref_ini->{$feldname}->{'place'},
-itemtype => 'window',
(-widget => $feld = $hlist->$browse($hash_ref_ini->{$feldname}->{'variable'} => \$hash_ref->{$datensatz_id}->{$feldname},
-width => $hash_ref_ini->{$feldname}->{'width'})));
if ($browse eq "BrowseEntry"){
$feld->insert('end',$_) for (@choices);
}
}
}
}#hlist_notebook
1
2
3
4
5
$hlist->itemCreate($e,
$hash_ref_ini->{$feldname}->{'place'},
-itemtype => 'window',
(-widget => $feld = $hlist->$browse($hash_ref_ini->{$feldname}->{'variable'} => \$hash_ref->{$datensatz_id}->{$feldname},
-width => $hash_ref_ini->{$feldname}->{'width'})));
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
#!/usr/bin/perl -w
#
use strict;
use Tk;
my $mw = tkinit();
my @text = qw(Checkbox1 Checkbox2 Checkbox3 Checkbox4);
my @var;
for my$i (0..$#text) {
$mw->Checkbutton(-text => $text[$i],
-variable => \$var[$i],
-command => [\&select,$i])->pack;
}
MainLoop;
#
#----------------------------------------------------------
#
sub select {
my $i = shift;
for my$j (0..$#text) {
if ($var[$j] == 1) { $var[$j] = 0 }
if ($j == $i) { $var[$j] = 1 }
}
}
|< 1 2 >| | 18 Einträge, 2 Seiten |