OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / lib / tk8.6 / demos / states.tcl
1 # states.tcl --
2 #
3 # This demonstration script creates a listbox widget that displays
4 # the names of the 50 states in the United States of America.
5
6 if {![info exists widgetDemo]} {
7     error "This script should be run from the \"widget\" demo."
8 }
9
10 package require Tk
11
12 set w .states
13 catch {destroy $w}
14 toplevel $w
15 wm title $w "Listbox Demonstration (50 states)"
16 wm iconname $w "states"
17 positionWindow $w
18
19 label $w.msg -font $font -wraplength 4i -justify left -text "A listbox containing the 50 states is displayed below, along with a scrollbar.  You can scan the list either using the scrollbar or by scanning.  To scan, press button 2 in the widget and drag up or down."
20 pack $w.msg -side top
21
22 ## See Code / Dismiss buttons
23 set btns [addSeeDismiss $w.buttons $w]
24 pack $btns -side bottom -fill x
25
26 frame $w.frame -borderwidth .5c
27 pack $w.frame -side top -expand yes -fill y
28
29 scrollbar $w.frame.scroll -command "$w.frame.list yview"
30 listbox $w.frame.list -yscroll "$w.frame.scroll set" -setgrid 1 -height 12
31 pack $w.frame.scroll -side right -fill y
32 pack $w.frame.list -side left -expand 1 -fill both
33
34 $w.frame.list insert 0 Alabama Alaska Arizona Arkansas California \
35     Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois \
36     Indiana Iowa Kansas Kentucky Louisiana Maine Maryland \
37     Massachusetts Michigan Minnesota Mississippi Missouri \
38     Montana Nebraska Nevada "New Hampshire" "New Jersey" "New Mexico" \
39     "New York" "North Carolina" "North Dakota" \
40     Ohio Oklahoma Oregon Pennsylvania "Rhode Island" \
41     "South Carolina" "South Dakota" \
42     Tennessee Texas Utah Vermont Virginia Washington \
43     "West Virginia" Wisconsin Wyoming