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.

In reply to Re: how to write a vertical TK Entry? by Marshall
in thread how to write a vertical TK Entry? by jsteng

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.