Tanalis has asked for the wisdom of the Perl Monks concerning the following question:
I'm currently updating a GUI I wrote some time ago, mainly to allow it to display data in a slightly different way.
I've written a loop to build a repetative part of the GUI, but I'm having problems with data not being placed into the two LabEntry widgets when they changes (it's part of a front end for a database search).
The %objects hash is in scope, and data is being assigned to this correctly. The checkbutton updates correctly when data is returned from the search, it is simply the two LabEntry widgets that don't.
My code for the loop is as follows:
my $dataFrame = $cpWindow -> Frame; foreach my $item ("Data1", "Data2") { my $lc_item = lc($item); $dataFrame -> Label(-text => ' ')->pack(-side => "left"); my $frame = $dataFrame -> Frame(-relief => "groove", -borderwidth => 1); $frame -> Label (-text => "[ $item ]" )->pack; $frame -> Label (-text => " ")->pack; $frame -> LabEntry (-label => "Component:", -width => 5, -labelPack => [ qw/-side left/ ], -textVariable => \$objects{"$lc_item\_component +"} )->pack; my $rat = $frame -> LabEntry(-label => "*Category:", -width => 5, -labelPack => [ qw/-side left/ ], -textVariable => \$objects{"$lc_item\_ +category"}, -state => "disabled" )->pack; $frame -> Checkbutton(-text => "Available", -variable => \$objects{"$lc_item\_a +vailable"}, -onvalue => "Y", -offvalue => "N", -highlightthickness => 0 )->pack; $objects{"$lc_item\_available"} = "N"; $frame -> pack(-side => "left"); }
If anyone can shed any light on this it'd be much appreciated.
Many thanks ..
--Foxcub
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tk GUI Building with Loops
by Chmrr (Vicar) on Nov 26, 2002 at 14:48 UTC |