Hi Monks, I have a question about using the entry widget. The number of entry widgets created depends on feedback from the user. This is stored in array @lb. The entry widget is created for every option in @lb. But I have not been able to enter values to these entry widgets. Suppose I have 3 variables in @lb, 3 entry widgets are created and all 3 take the same value. How do I modify my code to have each entry widget with its own value?
sub myListBox1{ my $var; my @arr123; my @lb = @_; my $mw = new MainWindow; $mw->title("Custom Adjustment"); foreach my $lab (@lb) { my $label = $mw->Label(-text=>"$lab")->pack(); my $entry = $mw->Entry( -textvariable => \ $var, -width=>30)->pack(); push @arr123, $var; } my $tx1= $mw->Label(-text=>" ")->pack(-anchor=>'center'); my $frame = $mw->Frame->pack( -anchor => 'w' ); $frame->Button(-text => "Exit", -width=>15, -command => sub{exit, $mw->destroy; })->pack(-side => "rig +ht", -anchor=>'cent +er', -fill => 'y'); $frame->Button(-text=>"Select", -command => sub{ $mw->destroy()}, )->pack(-side => "right", -anchor=>'center', -fill => 'y'); + MainLoop; return @arr123; }

In reply to Using Entry widget in a loop by Ppeoc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.