home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 September / WIN95_09962.iso / vrml / cp2b2x.exe / DATA.Z / states.tcl < prev    next >
Text File  |  1996-04-23  |  2KB  |  42 lines

  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. # @(#) states.tcl 1.1 95/05/26 15:56:39
  7.  
  8. set w .states
  9. catch {destroy $w}
  10. toplevel $w
  11. wm title $w "Listbox Demonstration (50 states)"
  12. wm iconname $w "states"
  13. positionWindow $w
  14.  
  15. 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."
  16. pack $w.msg -side top
  17.  
  18. frame $w.buttons
  19. pack  $w.buttons -side bottom -expand y -fill x -pady 2m
  20. button $w.buttons.dismiss -text Dismiss -command "destroy $w"
  21. button $w.buttons.code -text "See Code" -command "showCode $w"
  22. pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
  23.  
  24. frame $w.frame -borderwidth .5c
  25. pack $w.frame -side top -expand yes -fill y
  26.  
  27. scrollbar $w.frame.scroll -command "$w.frame.list yview"
  28. listbox $w.frame.list -yscroll "$w.frame.scroll set" -setgrid 1 -height 12
  29. pack $w.frame.scroll -side right -fill y
  30. pack $w.frame.list -side left -expand 1 -fill both
  31.  
  32. $w.frame.list insert 0 Alabama Alaska Arizona Arkansas California \
  33.     Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois \
  34.     Indiana Iowa Kansas Kentucky Louisiana Maine Maryland \
  35.     Massachusetts Michigan Minnesota Mississippi Missouri \
  36.     Montana Nebraska Nevada "New Hampshire" "New Jersey" "New Mexico" \
  37.     "New York" "North Carolina" "North Dakota" \
  38.     Ohio Oklahoma Oregon Pennsylvania "Rhode Island" \
  39.     "South Carolina" "South Dakota" \
  40.     Tennessee Texas Utah Vermont Virginia Washington \
  41.     "West Virginia" Wisconsin Wyoming
  42.