| 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

Spinner

Spinners constitute a set of widgets which provide EntryField functionality combined with increment and decrement arrow buttons which may be oriented in a vertical, top and bottom, fashion or in a horizontal, side by side, manner. A value may be entered into the entry area explicitly or the buttons may be pressed which cycle up and down through the choices. This latter behavior is one of spinning. For further information, see the Spinner manpage

Components: downarrow entry hull label uparrow
				

wm title . "Spinner Example"

set months {Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec}

##
##	Helper procs
##
proc blockInput {} {return 0}

proc spinMonth {direction} {
    global months

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

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

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

	return
}

##=========================================================
##	Create a spinner iwidget
##=========================================================
##
iwidgets::spinner .sm \
	-labeltext "Enter Month : " \
	-width 5 \
	-fixed 3 \
	-validate blockInput \
	-decrement {spinMonth -1} \
	-increment {spinMonth 1}

.sm insert 0 [clock format [clock seconds] -format "%b"]

pack .sm \
	-padx 10 \
	-pady 10

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