|
|
| XP is just a number | |
| PerlMonks |
Tk::Entry and double-Tab key weirdnessby atreyu (Acolyte) |
| on May 25, 2012 at 16:55 UTC ( #972490=perlquestion: print w/ replies, xml ) | Need Help?? |
|
atreyu has asked for the
wisdom of the Perl Monks concerning the following question:
Hi gurus, monks, monkeys, and other caffeinated types,
I have a small Tk gui that uses Tk::Entry input to get a MAC. I got most of the code from an old thread here. It works great, but I found a weird bug: When I put invalid text into a field that represents a MAC octet (e.g. "zz"), and then try to leave the field (via Tab key or mouse-click), it properly forces me back into the field with the errant entry. The problem is, if I hit the Tab key twice in quick succession, it will pop me out of the bad field, and what's more (worse), will seem to "forget" about the field, as you will see if you run the code. To replicate, enter "zz" in a field, double-hit Tab quickly, then hit Tab regularly to hop thru the other (blank) fields. When you come back around to the "zz" field, it won't run the validation check again - no matter if the bad string is removed/replaced, etc.
Edit: If you can't replicate the problem using the Tab key, it also seems to happen if you pre-populate a field's textvariable with an invalid string. For example, inserting this line into the loop will make the 3rd field fail initial validation, but will allow focus to pass thru it without subsequently attempting validation:
Back to
Seekers of Perl Wisdom
|
|