Rook has asked for the wisdom of the Perl Monks concerning the following question:
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.# 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"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Seeking to Add Scrollbar
by ww (Archbishop) on Jan 17, 2013 at 19:26 UTC | |
by SuicideJunkie (Vicar) on Jan 17, 2013 at 21:31 UTC | |
by ww (Archbishop) on Jan 17, 2013 at 23:00 UTC | |
by Rook (Initiate) on Jan 17, 2013 at 21:52 UTC | |
|
Re: Seeking to Add Scrollbar
by Anonymous Monk on Jan 18, 2013 at 01:12 UTC |