wm title . "Entryfield Example" ## ## supporting proc for the -command options ## proc updateValues {} { global values foreach e {name address age occupation} { set values($e) [.$e get] puts "$e is $values($e)" } return }; # end proc updateValues ## ## Proc to demonstrate the focus and invalid ## options ## proc showMsg {txt color} { .label configure \ -text "$txt" \ -foreground $color return }; #end proc showMsg ##========================================================= ## Create some entryfield iwidgets ##========================================================= ## iwidgets::entryfield .name \ -validate alphabetic \ -labeltext Name: \ -focuscommand {showMsg "Enter Your Name" blue} \ -invalid {showMsg "Use Only Letters" red} \ -command {updateValues} iwidgets::entryfield .address \ -validate alphanumeric \ -labeltext Address: \ -focuscommand {showMsg "Enter Your address" blue} \ -invalid {showMsg "Use Only Letters And Numbers" red} \ -command {updateValues} iwidgets::entryfield .age \ -validate numeric \ -fixed 3 \ -labeltext "Age:" \ -focuscommand {showMsg "Enter Your Age" blue} \ -invalid {showMsg "Use Only Numbers" red} \ -command {updateValues} iwidgets::entryfield .occupation \ -validate alphabetic \ -labeltext "Occupation:" \ -focuscommand {showMsg "Enter Your Occupation" blue} \ -invalid {showMsg "Use Only Letters" red} \ -command {updateValues} iwidgets::Labeledwidget::alignlabels .name .address .age .occupation label .label \ -foreground blue \ -relief groove ## ## Add some default data ## .occupation insert 0 programmer ## ## Select the default data ## .occupation selection range 0 end pack .name .address .age .occupation .label\ -side top \ -pady 5 \ -padx 10 \ -fill x \ -expand yes