You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
767 B
Plaintext
29 lines
767 B
Plaintext
# ----------------------------------------------------------------------
|
|
# DEMO: spinner in [incr Widgets]
|
|
# ----------------------------------------------------------------------
|
|
package require Iwidgets 4.0
|
|
|
|
option add *textBackground seashell
|
|
|
|
proc spinMonth {win step} {
|
|
set months {
|
|
January February March April
|
|
May June July August September
|
|
October November December
|
|
}
|
|
|
|
set index [expr [lsearch $months [$win get]] + $step]
|
|
|
|
if {$index < 0} {set index 11}
|
|
if {$index > 11} {set index 0}
|
|
|
|
$win delete 0 end
|
|
$win insert 0 [lindex $months $index]
|
|
}
|
|
|
|
iwidgets::spinner .sm -labeltext "Month:" -width 10 -fixed 10 \
|
|
-decrement {spinMonth .sm -1} -increment {spinMonth .sm 1}
|
|
|
|
pack .sm
|
|
.sm insert 0 "January"
|