3 # This demonstration script creates a listbox widget that displays
4 # the names of the 50 states in the United States of America.
6 if {![info exists widgetDemo
]} {
7 error "This script should be run from the \"widget\" demo."
15 wm title
$w "Listbox Demonstration (50 states)"
16 wm iconname
$w "states"
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."
22 ## See Code / Dismiss buttons
23 set btns
[addSeeDismiss
$w.buttons
$w]
24 pack $btns -side bottom
-fill x
26 frame $w.
frame -borderwidth .5c
27 pack $w.
frame -side top
-expand yes
-fill y
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
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