3 # This demonstration script creates several spinbox widgets.
5 # RCS: @(#) $Id: spin.tcl,v 1.1 2001/10/30 11:21:50 dkf Exp $
7 if {![info exists widgetDemo
]} {
8 error "This script should be run from the \"widget\" demo."
14 wm title
$w "Spinbox Demonstration"
18 label $w.msg
-font $font -wraplength 5i
-justify left
-text "Three different\
19 spin-boxes are displayed below. You can add characters by pointing,\
20 clicking and typing. The normal Motif editing characters are\
21 supported, along with many Emacs bindings. For example, Backspace\
22 and Control-h delete the character to the left of the insertion\
23 cursor and Delete and Control-d delete the chararacter to the right\
24 of the insertion cursor. For values that are too large to fit in the\
25 window all at once, you can scan through the value by dragging with\
26 mouse button2 pressed. Note that the first spin-box will only permit\
27 you to type in integers, and the third selects from a list of\
32 pack $w.buttons
-side bottom
-fill x
-pady 2m
33 button $w.buttons.dismiss
-text Dismiss
-command "destroy $w"
34 button $w.buttons.code
-text "See Code" -command "showCode $w"
35 pack $w.buttons.dismiss
$w.buttons.code
-side left
-expand 1
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
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."