Thread Eingabeüberprüfung: Eingabeüberprüfung direkt bei Eingabe (4 answers)
Opened by Olav_888 at 2004-05-13 15:18

alexus-777
 2004-05-13 15:21
#42075 #42075
User since
2004-04-13
121 Artikel
BenutzerIn
[default_avatar]
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

Code: (dl )
1
2
3
4
5
6
7
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-->

View full thread Eingabeüberprüfung: Eingabeüberprüfung direkt bei Eingabe