Ok, I took another stab at this... It's been a very, very long time since I did Tk.
This code provides 5 vertical entry fields which can be edited (that's what you can do to an entry field as opposed to a label or a button). You press the 'Print Values' button to see the edited values of these entry windows. I omitted the pack() details which can specify width, etc and also wrap around if desired. Tweaking these details can be time consuming.
The main point here is whether or not I have the general idea of what you wanted?
use strict;
use warnings;
use Tk;
use Data::Dumper;
my $mw = MainWindow->new();
my @entry_refs;
foreach (qw (1 2 3 4 5) )
{
push @entry_refs, create_entry_object ($mw, "Default Value is: $_"
+, );
}
$mw->Button(-text => 'Print Values', -command => \&list_entries)->pack
+();
MainLoop;
sub list_entries
{
print "\n";
foreach my $ref (@entry_refs)
{
print "$$ref\n";
}
}
sub create_entry_object
{
my $window = shift;
my $text_var = shift;
$window->Entry(-textvar => \$text_var )->pack;
return \$text_var;
}
Update: I looked back at this code and it appears to me that you need some Label objects to the left of the "ENTRY" objects. Take a stab at that and let us know how you are doing.