Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | ||
3 | sub showVars { | |
4 | ||
5 | # Create a top-level window that displays a bunch of global variable values | |
6 | # and keeps the display up-to-date even when the variables change value. | |
7 | # | |
8 | # Arguments: | |
9 | # w - Perl widget reference of parent. | |
10 | # vars - Name of variable(s) to monitor. | |
11 | ||
12 | $showVars->destroy if Exists($showVars); | |
13 | $showVars = shift->Toplevel(); | |
14 | my $w = $showVars; | |
15 | dpos($w); | |
16 | $w->title('Variable values'); | |
17 | $w->iconname('Variables'); | |
18 | ||
19 | my $w_title = $w->Label(-text => 'Variable values:', -width => 20, -anchor, 'center', | |
20 | -font => '-Adobe-helvetica-medium-r-normal--*-180-*-*-*-*-*-*'); | |
21 | $w_title->pack(-fill => 'x'); | |
22 | my $i; | |
23 | foreach $i (@_) { | |
24 | my $w_i = $w->Frame(); | |
25 | my $w_i_name = $w_i->Label(-text => "$i: "); | |
26 | my $w_i_value = $w_i->Label(-textvariable => \${$i}); | |
27 | $w_i_name->pack(-side => 'left'); | |
28 | $w_i_value->pack(-side => 'left'); | |
29 | $w_i->pack(-side => 'top', -anchor => 'w'); | |
30 | } | |
31 | $w->Button(-text => 'OK', -command => [$w => 'destroy'])-> | |
32 | pack(-side => 'bottom', -pady => 2); | |
33 | ||
34 | } # end showVars | |
35 | ||
36 | ||
37 | 1; |