2 # ----------------------------------------------------------------------
3 # DEMO: entryfield in [incr Widgets]
4 # ----------------------------------------------------------------------
6 exec itkwish "$0" ${1+"$@"}
7 package require Iwidgets 3.0
9 # itkwish interprets the rest...
10 # ----------------------------------------------------------------------
11 option add *textBackground seashell
12 . configure -background white
14 iwidgets::entryfield .login -labeltext "Login:" -labelpos nw \
15 -command { focus [.passwd component entry] }
16 pack .login -padx 4 -pady 4
18 iwidgets::entryfield .passwd -labeltext "Password:" -labelpos nw -show "\267" \
19 -command { focus [.phone component entry] }
20 pack .passwd -padx 4 -pady 4
22 iwidgets::entryfield .phone -labeltext "Phone:" -labelpos nw \
23 -command { focus [.login component entry] } \
24 -validate {check_phonenum %W "%c"}
25 pack .phone -padx 4 -pady 4
27 proc check_phonenum {entry char} {
28 set current [$entry get]
29 set len [string length $current]
30 if {$len == 3 || $len == 7} {
32 $entry insert 0 "$current-"
34 if {$len < 12 && [string match {[0-9]} $char]} {