|
Datefield
The datefield iwidget is a specialty entry widget that allows the user to enter dates more readily. The date can be modified by typing in the entry or by using the show public method. The show method also accepts relative dates, as in "yesterday" or "2 days ago". By default, the current date is shown in the entry. The dates can also be automatically validated by setting the -iq option and/or the isvalid public method.
For further information, see the Datefield
manpage
Components: date hull label
|
wm title . "Datefield Example"
##
## supporting procedure to print
## the contents of a datefield entry
##
proc print {wid} {
puts "The date selected is: [.$wid get]"
return
}
##=========================================================
## Create a few Datefield iwidgets
##
## Note that string totitle is valid for tcl_version >= 8.1
##=========================================================
##
foreach d {birthday anniversary today} {
iwidgets::datefield .$d \
-labeltext "[string totitle $d]:" \
-command "print $d"
pack .$d
}
iwidgets::Labeledwidget::alignlabels .birthday .anniversary .today
##
## Show an initial date
##
.birthday show 1/1/2000
.anniversary show 1/1/2000
|
Download this sample code |
|