Upgrade to Tcl/Tk 8.5b2
[msysgit.git] / mingw / lib / tk8.5 / demos / spin.tcl
blob512515d5b6d36a30a5ccfe3032698b38df9fd584
1 # spin.tcl --
3 # This demonstration script creates several spinbox widgets.
5 # RCS: @(#) $Id: spin.tcl,v 1.3 2004/12/21 11:56:35 dkf Exp $
7 if {![info exists widgetDemo]} {
8 error "This script should be run from the \"widget\" demo."
11 package require Tk
13 set w .spin
14 catch {destroy $w}
15 toplevel $w
16 wm title $w "Spinbox Demonstration"
17 wm iconname $w "spin"
18 positionWindow $w
20 label $w.msg -font $font -wraplength 5i -justify left -text "Three different\
21 spin-boxes are displayed below. You can add characters by pointing,\
22 clicking and typing. The normal Motif editing characters are\
23 supported, along with many Emacs bindings. For example, Backspace\
24 and Control-h delete the character to the left of the insertion\
25 cursor and Delete and Control-d delete the chararacter to the right\
26 of the insertion cursor. For values that are too large to fit in the\
27 window all at once, you can scan through the value by dragging with\
28 mouse button2 pressed. Note that the first spin-box will only permit\
29 you to type in integers, and the third selects from a list of\
30 Australian cities."
31 pack $w.msg -side top
33 ## See Code / Dismiss buttons
34 set btns [addSeeDismiss $w.buttons $w]
35 pack $btns -side bottom -fill x
37 set australianCities {
38 Canberra Sydney Melbourne Perth Adelaide Brisbane
39 Hobart Darwin "Alice Springs"
42 spinbox $w.s1 -from 1 -to 10 -width 10 -validate key \
43 -vcmd {string is integer %P}
44 spinbox $w.s2 -from 0 -to 3 -increment .5 -format %05.2f -width 10
45 spinbox $w.s3 -values $australianCities -width 10
47 #entry $w.e1
48 #entry $w.e2
49 #entry $w.e3
50 pack $w.s1 $w.s2 $w.s3 -side top -pady 5 -padx 10 ;#-fill x
52 #$w.e1 insert 0 "Initial value"
53 #$w.e2 insert end "This entry contains a long value, much too long "
54 #$w.e2 insert end "to fit in the window at one time, so long in fact "
55 #$w.e2 insert end "that you'll have to scan or scroll to see the end."