#!/bin/sh
# \
	exec itkwish -f "$0" ${1+"$@"}

wm title . Spinner

option add *textBackground GhostWhite

set months {January February March April May June July \
	    August September October November December}

proc blockInput {} {
    return 0
}

proc spinMonth {step} {
    global months

    set index [expr [lsearch $months [.sm get]] + $step]

    if {$index < 0} {set index 11}
    if {$index > 11} {set index 0}

    .sm delete 0 end
    .sm insert 0 [lindex $months $index]
}

spinner .sm -labeltext "Month : " -width 10 -fixed 10 -validate blockInput \
	-decrement {spinMonth -1} -increment {spinMonth 1}
.sm insert 0 January

pack .sm -padx 10 -pady 10