Dear all.
I use the following code to force a default value for the entry if the input value is rejected by -validatecommand.
use 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},
);
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 lot