Hi again,

Problem 1: When the app first starts up, I use eventGenerate bindings (to Tab and KeyRelease) to automatically tab thru all the MAC input fields and "auto-validate" the initial values. It works great, but if a bad octet is discovered, it will still continue to validate all the subsequent octets.

Instead of eventGenerate, maybe try looping thru all Entries using $entry->focusForce?

Problem 2: I can't keep the Tab order in the way I want it.

Try this code:

#!/usr/bin/perl use Tk; use strict; use warnings; my $win = MainWindow->new(); $win->Button(-text=>'Other Window',-command=>\&otherwindow)->pack; sub otherwindow { my $otherwin = $win->Toplevel; my $foo = $otherwin->Entry->pack; my $bar = $otherwin->Entry->pack; my $baz = $otherwin->Entry->pack; # &defineOrder($foo, $bar, $baz); &defineOrder($baz, $bar, $foo); } sub defineOrder { my $widget; for (my $i=0; defined( $_[$i+1] ); $i++) { $_[$i]->bind('<Key-Return>', [\&focus, $_[$i+1]]); } # Uncomment this line if you want to wrap around #$_[$#_]->bind('<Key-Return>', [\&focus, $_[0]]); $_[0]->focus; } sub focus { my ($tk, $self) = @_; $self->focus; } MainLoop();

I have a funny feeling that you are the only one still seeing this thread (i.e., the only monk I'm bugging)...maybe i'm just not good w/the forum views. can u tell me how I can view recently updated threads, or how do others know when a thread has been updated, if they aren't currently "subscribed" to it? Or is there no such thing?

Monks usually look thru the Notes section, below SOPW, and see if there is a reply which they are interested in. Maybe Perlmonks could do a Facebook-like hack and charge $2 bucks to keep your reply to the top of the list. :-)

Your best bet to get more monks to look at your problem, especially after making major code modifications, is to post a new SOPW node, and mention this node as a reference.

I mentioned that entry validation is very hard to deal with correctly, and your code now has become quite complex. That probably scares off the casual monk. You should try to make smaller examples which only demonstrate one of the glitches you are running into, if you want more viewers.

P.S. As I was considering all your difficulties, and musing how I might tackle it, I came up with an idea which may help you. Instead of relying totally on the validated entry widget to hold all the correct entry data, why not put a parallel set of read-only Entry widgets( or properly packed set of Label widgets ) aligned right on top of your current widget set. The idea would be that as valid entry text is detected, the corresponding Label would change, and you would be focused to the next invalid Label and it's corresponding validation Entry widget. You would put all your -textvariable data into the Labels, and test them for validity with your own routine, and change bg color for each invalid value. Then you would use the validation Entries solely for entering values to be placed in the Labels, if valid. The user would know they are done, when all the Labels have white background instead of hotpink. :-)

I hope I got the idea across. It would free you up from being confined to all the internal bindings of the validation Entry.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re^9: Tk::Entry and double-Tab key weirdness by zentara
in thread Tk::Entry and double-Tab key weirdness by atreyu

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.