Hi everyone,
I'm not a Perl programmer myself, but I use Perl/Tk scripting to run the USEPA environmental modeling tool program, PE5 (http://www.epa.gov/oppefed1/models/water/pe5.pl).
I'm looking to add a scroll-bar to a particular window created by the script. The section of the script I 'think' needs to be modified is this:
# Dialog box for editing applicaton intervals
sub setAppIntervals {
debug("+setAppIntervals");
my $n = shift; # The number of applications
# remove 1st value since it's applied before the 1st interval
my $n_missing = $#AppInt - $#moreRates;
@moreRates = (@moreRates, ("") x $n_missing) if($n_missing > 0);
my $appDial = $mainwindow->DialogBox(-title => "Edit application int
+ervals",
-buttons => ["Done"]);
my $title = "Enter application\nintervals (days)";
# $appDial->Label(-textvariable=> \$title)->pack(-side => "top",
# -anchor => "nw", -fill => 'y');
my $lablCol = $appDial->Frame->grid(-row=>0, -column=>0, -sticky=>'n
+w');
my $intvCol = $appDial->Frame->grid(-row=>0, -column=>1, -sticky=>'n
+w');
my $rateCol = $appDial->Frame->grid(-row=>0, -column=>2, -sticky=>'n
+w');
# label the cols, firt col has a blank label to push the col's widge
+ts down
$lablCol->Label(-text => "", -width=>6)->pack(-side=>"top",-anchor =
+> "nw");
$intvCol->Label(-text => "interval", -width=>6)->pack(-side => "top"
+,
-anchor => "nw");
$rateCol->Label(-text => "rate (kg/ha)", -width=>12)->
pack(-side => "top", -anchor => "nw");
if($n > 1) {
for my $i(2..$n) {
$lablCol -> Label(-text => "Application $i:",-pady=>2)->
pack(-side => 'top', -anchor => 'nw');
$intvCol->Entry(-width => 6, -bg => 'white',
-textvariable => \$AppInt[$i-2])->pack(-side => "top",
-padx => 1, -pady=>1, -anchor => "nw");
$rateCol -> Entry(-width => 9, -bg => 'white',
-textvariable => \$moreRates[$i-2])->pack(-side=>'top',
-padx => 1, -pady => 1, -anchor => 'nw');
}
my $result = $appDial->Show; # Execute the dialog box
}
for(my $i = $#AppInt ; $i>$n-2 ; $i--) {
pop @AppInt; # remove extra values from @AppInt
pop @moreRates;
}
debug("-setAppIntervals; rates now set to @moreRates");
}
The way the window currently constructs itself limits the number of application intervals I can define because the window can only display so many fields. If possible, I'd love to attach a scroll-bar to this window so I can edit up to 150 application intervals.
Could anyone help me add a bit of script to accomplish this? Thank you.