| Itcl  | Itk  | Itcl @ Wiki  | Itcl @ SF  | Tcl  | Tcl @ Wiki |
  home || iwidgets || man pages cross ref distribution docs faq  
buttonbox
calendar
canvasprintbox
canvasprintdialog
checkbox
combobox
dateentry
datefield
dialog
dialogshell
disjointlistbox
entryfield
extbutton
extfileselectionbox
extfileselectiondialog
feedback
fileselectionbox
fileselectiondialog
finddialog
hierarchy
hyperhelp
labeledframe
labeledwidget
mainwindow
menubar
messagebox
messagedialog
notebook
optionmenu
panedwindow
promptdialog
pushbutton
radiobox
regexpfield
scrolledcanvas
scrolledframe
scrolledhtml
scrolledlistbox
scrolledtext
scrolledwidget
selectionbox
selectiondialog
shell
spindate
spinint
spinner
spintime
tabnotebook
tabset
timeentry
timefield
toolbar
watch

man page | options | methods

Entryfield

The entryfield iwidget associates a label with an entry widget, providing text entry, length, validation, and editing enhancements. Since the class is based on the Labeledwidget class, all the options and methods for Labeledwidgets are supported in Entryfields. Also, most of the methods for the standard Tk entry widget are provided such as insert, delete, get, and scan. For further information, see the Entryfield manpage

Components: entry hull label
				

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

Download this sample code
man page | options | methods
 
  home || iwidgets || man pages cross ref distribution docs faq  
Copyright | Contributions | Development Team | Credits
Bugs/Comments/Suggestions about this web site