1
0
Fork 0
This repository has been archived on 2019-12-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
arduinisten/arduino-0018-windows/hardware/tools/avr/share/iwidgets4.0.1/demos/entryfield

34 lines
1 KiB
Text
Raw Normal View History

2010-03-30 21:53:44 +02:00
# ----------------------------------------------------------------------
# DEMO: entryfield in [incr Widgets]
# ----------------------------------------------------------------------
package require Iwidgets 4.0
option add *textBackground seashell
. configure -background white
iwidgets::entryfield .login -labeltext "Login:" -labelpos nw \
-command { focus [.passwd component entry] }
pack .login -padx 4 -pady 4
iwidgets::entryfield .passwd -labeltext "Password:" -labelpos nw -show "\267" \
-command { focus [.phone component entry] }
pack .passwd -padx 4 -pady 4
iwidgets::entryfield .phone -labeltext "Phone:" -labelpos nw \
-command { focus [.login component entry] } \
-validate {check_phonenum %W "%c"}
pack .phone -padx 4 -pady 4
proc check_phonenum {entry char} {
set current [$entry get]
set len [string length $current]
if {$len == 3 || $len == 7} {
$entry delete 0 end
$entry insert 0 "$current-"
}
if {$len < 12 && [string match {[0-9]} $char]} {
return 1
}
return 0
}