http://qs321.pair.com?node_id=244657


in reply to Re: Tk/Perl Command
in thread Tk/Perl Command

In think you misunderstood me. I don't want the text on the button to change but I actually have a whole hash of Entry Boxes that need to have their information updated. Second, the varname was just an example. posted below is my current code (w/o the extra subroutines to save space)
se strict; use Tk 800.00; use Mysql; require Tk::Frame; require Tk::TextUndo; require Tk::Text; require Tk::Scrollbar; require Tk::Menu; require Tk::Menubutton; require Tk::Adjuster; require Tk::DialogBox; # Main Window my $mw = new MainWindow; $mw->geometry('800x600'); # Frames Setup my $lf = $mw->Frame->pack(qw/-side left -fill y/); my $rf = $mw->Frame->pack(qw/-side right -fill y/); # Menu Bar Setup my $mb = $mw->Menu(-menuitems => &menubar_menuitems() ); $mw->configure(-menu => $mb); $mw->title("INSCO Inventory Control"); #Set Up Serial Query Information my $label_input = $lf->Label(-text=>'Serial Number: ',)->pack(qw/-si +de top/); my $tf_serial = $lf->Entry(-width=>30)->pack(qw/-side top/); my $label_space = $lf->Label(-text=>'',)->pack(qw/-side top/); my $returned = "";
Right here is where I'm working.
##Set up query button my @info; my $button_submit = $lf->Button( -text => 'Search', -command => my \@info = \&get_data )->pack(qw//); print $info[1]; #Set Up Client Information my %field; my @names = (qw/tf_po tf_client tf_contact tf_phone tf_email tf_addres +s tf_city tf_state tf_zip tf_id tf_model/); my @sizes = ( 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30); my @labls = ("PO:", "Client:", "Contact:", "Contact Phone Number:", "C +ontact Email Address:", "Contact Post Address:", "", "" , "", "Client + Specified ID", "Model"); my @pos = (1,2,3,4,5,6,7,8,9,10,11); foreach (@names) { my $position = shift(@pos); $field{$_}{txvar} = ''; $field{$_}{label} = $rf->Label( -text => shift( @labls )) ->grid(-row => '$position', -col => '0', ); $field{$_}{entry} = $rf->Entry( -width => shift( @sizes ), -textvariable => '', )->grid(-row => '$position', -col => '2', ); } # Start the main event loop MainLoop; sub get_data { my $entered = $tf_serial->get; my $dbh = Mysql->connect("host", "database", "username", "******** +") or die("Could Not Connect To Server"); my $query = qq~SELECT * FROM inventory WHERE serial='$entered'~; my $sth = $dbh->query($query); my @arr = $sth->fetchrow; return(@arr); }