Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear all.
I use the following code to force a default value for the entry if the input value is rejected by -validatecommand.
It works fine but only once! If the user tries to modify the entry a second time with a wrong input the validate command is ineffective. Would you have any advice to make it work? Thanks a lotuse strict; use Tk; my $xVConsSflEmbMax0 = 1.0; my $xVConsSflEmbMax = $xVConsSflEmbMax0; my $emb1Entry = $embCanvas->Entry( -textvariable => \$xVConsSflEmbMax, -width => 3, -validate => 'focusout', -validatecommand => sub {$_[0] =~ /^\d*\.?\d+$/}, -invalidcommand => sub {$xVConsSflEmbMax=$xVConsSflEmbMax0}, );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: perl/Tk Entry validation
by zentara (Archbishop) on Jul 24, 2012 at 10:14 UTC | |
by contact@solamen.fr (Novice) on Jul 24, 2012 at 12:43 UTC | |
by choroba (Cardinal) on Jul 24, 2012 at 13:09 UTC | |
by contact@solamen.fr (Novice) on Jul 24, 2012 at 13:33 UTC | |
by choroba (Cardinal) on Jul 24, 2012 at 13:57 UTC | |
Re: perl/Tk Entry validation
by choroba (Cardinal) on Jul 24, 2012 at 10:12 UTC |
Back to
Seekers of Perl Wisdom