Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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
Node Status?
node history
Node Type: note [id://249764]
[shmem]: LanX: now I have to find a succinct transformation FOOL => MONK
[LanX]: yeah but Marto already proposed a new "Lex Sun-D" ...
[karlgoethebier]: the word really exists: http://www. urbandictionary. com/define.php? term=fool
[shmem]: ...possibly involving RTFM
[karlgoethebier]: big surprise!
[Eily]: LanX I try to avoid answering, but I did feel that this one post was going into much detail to prove a false claim (that SHA-1 is secure, I was just wrong about how insecure it is)
[LanX]: ironically...
[LanX]: yeah whatever ... I'm in the favorable condition to already autohiding him ... how can I judge the poor FOOLs who still see his contributions xD
[Eily]: he's been pretty saavy about threads that were implictly about him in the past. I think he might have deliberatly avoiding mentioning it for some reason (he got tired?)
[Eily]: he did mention one of his propositions: basically make it possible to ignore downvotes, by separating them more from the upvotes

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2017-07-24 17:23 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (356 votes). Check out past polls.