Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Newbie Tk Data collection Question

by hiseldl (Priest)
on Apr 10, 2003 at 22:58 UTC ( #249764=note: print w/replies, xml ) Need Help??

in reply to Newbie Tk Data collection Question

Basically all you need to do is pass the reference of your quantity array to the textvariable option. The quantity array should have the same index as the corresponding part number. Note that this will overwrite the values in your quantity array, so if you want to keep the original values then you will need to copy them to a different array and use that array as the textvariable reference. Here's an example:

use Tk; use Tk::LabEntry; use strict; use warnings; my $top = MainWindow->new(); my @form = (); my @partname = ("Widget One", "Widget Two", "Widget Thr"); my @quantity = (11 , 22 , 33 ); for(my$i=0; $i<@partname; $i++) { $form[$i] = $top->LabEntry(-label => "$partname[$i]", ##### note the reference to the -textvariable, it is ##### a reference to your quantity array with the ##### index that corresponds to the part number -textvariable => \$quantity[$i], )->pack; } MainLoop; ##### here I just dump the values to stdout for(my$i=0; $i<@partname; $i++) { print "Part: $partname[$i], New Quantity: ", $quantity[$i],"\n"; $i++; }
download this code and try it. Change the values from 11, 22, 33 to whatever you want, then exit and look at the values that are dumped, they should be the same as what you typed in.

What time is it? It's Camel Time!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://249764]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-01-17 10:43 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (51 votes). Check out past polls.