Hallo,
dafür gibtes -validatecommand option:
-validate => validateMode
Specifies the events that invoke the -validatecommand callback: none (default), focus, focusin, focusout, key, or all.
-validatecommand => callback
Specifies a callback that validates the input; undef disables this feature (default). The callback returns false to reject the new input and invoke the -invalidcommand callback or true to accept the input.
Gruß Alexander
edit: Beispiel
my $entry = $frame ->
Entry ( -justify=>'left', -relief=>'sunken', -textvariable=>\$entry_var ,
-validate => "key",
-validatecommand => sub {$_[1] =~ /[a-zA-Z_-]/},
-invalidcommand => sub {print "bitte nur Buchstaben eingeben";},
-width=>12, -state=>'normal' ) ->
pack(-anchor=>'w', -side=>'left');
\n\n
<!--EDIT|alexus-777|1084447537-->