~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to gcl-tk/demos/mkListbox.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# mkListbox w
 
2
#
 
3
# Create a top-level window that displays a listbox with the names of the
 
4
# 50 states.
 
5
#
 
6
# Arguments:
 
7
#    w -        Name to use for new top-level window.
 
8
 
 
9
proc mkListbox {{w .l1}} {
 
10
    catch {destroy $w}
 
11
    toplevel $w
 
12
    dpos $w
 
13
    wm title $w "Listbox Demonstration (50 states)"
 
14
    wm iconname $w "Listbox"
 
15
    wm minsize $w 1 1
 
16
 
 
17
    message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
 
18
            -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 dragging in the listbox window with button 2 pressed.  Click the \"OK\" button when you've seen enough."
 
19
    frame $w.frame -borderwidth 10
 
20
    button $w.ok -text OK -command "destroy $w"
 
21
    pack $w.msg -side top
 
22
    pack $w.frame -side top -expand yes -fill y
 
23
    pack $w.ok -side bottom -fill x
 
24
 
 
25
    scrollbar $w.frame.scroll -relief sunken -command "$w.frame.list yview"
 
26
    listbox $w.frame.list -yscroll "$w.frame.scroll set" -relief sunken \
 
27
            -setgrid 1
 
28
    pack $w.frame.scroll -side right -fill y
 
29
    pack $w.frame.list -side left -expand yes -fill both
 
30
 
 
31
    $w.frame.list insert 0 Alabama Alaska Arizona Arkansas California \
 
32
        Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois \
 
33
        Indiana Iowa Kansas Kentucky Louisiana Maine Maryland \
 
34
        Massachusetts Michigan Minnesota Mississippi Missouri \
 
35
        Montana Nebraska Nevada "New Hampshire" "New Jersey" "New Mexico" \
 
36
        "New York" "North Carolina" "North Dakota" \
 
37
        Ohio Oklahoma Oregon Pennsylvania "Rhode Island" \
 
38
        "South Carolina" "South Dakota" \
 
39
        Tennessee Texas Utah Vermont Virginia Washington \
 
40
        "West Virginia" Wisconsin Wyoming
 
41
}