Update tk to version 8.5.11
[git/jnareb-git.git] / mingw / lib / tk8.5 / demos / paned2.tcl
blobf481d14027a2665d2172ee1b4cfdf9f3b4c82bcc
1 # paned2.tcl --
3 # This demonstration script creates a toplevel window containing
4 # a paned window that separates two windows vertically.
6 if {![info exists widgetDemo]} {
7 error "This script should be run from the \"widget\" demo."
10 package require Tk
12 set w .paned2
13 catch {destroy $w}
14 toplevel $w
15 wm title $w "Vertical Paned Window Demonstration"
16 wm iconname $w "paned2"
17 positionWindow $w
19 label $w.msg -font $font -wraplength 4i -justify left -text "The sash between the two scrolled windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)"
20 pack $w.msg -side top
22 ## See Code / Dismiss buttons
23 set btns [addSeeDismiss $w.buttons $w]
24 pack $btns -side bottom -fill x
26 # Create the pane itself
27 panedwindow $w.pane -orient vertical
28 pack $w.pane -side top -expand yes -fill both -pady 2 -padx 2m
30 # The top window is a listbox with scrollbar
31 set paneList {
32 {List of Tk Widgets}
33 button
34 canvas
35 checkbutton
36 entry
37 frame
38 label
39 labelframe
40 listbox
41 menu
42 menubutton
43 message
44 panedwindow
45 radiobutton
46 scale
47 scrollbar
48 spinbox
49 text
50 toplevel
52 set f [frame $w.pane.top]
53 listbox $f.list -listvariable paneList -yscrollcommand "$f.scr set"
54 # Invert the first item to highlight it
55 $f.list itemconfigure 0 \
56 -background [$f.list cget -fg] -foreground [$f.list cget -bg]
57 scrollbar $f.scr -orient vertical -command "$f.list yview"
58 pack $f.scr -side right -fill y
59 pack $f.list -fill both -expand 1
61 # The bottom window is a text widget with scrollbar
62 set f [frame $w.pane.bottom]
63 text $f.text -xscrollcommand "$f.xscr set" -yscrollcommand "$f.yscr set" \
64 -width 30 -height 8 -wrap none
65 scrollbar $f.xscr -orient horizontal -command "$f.text xview"
66 scrollbar $f.yscr -orient vertical -command "$f.text yview"
67 grid $f.text $f.yscr -sticky nsew
68 grid $f.xscr -sticky nsew
69 grid columnconfigure $f 0 -weight 1
70 grid rowconfigure $f 0 -weight 1
71 $f.text insert 1.0 "This is just a normal text widget"
73 # Now add our contents to the paned window
74 $w.pane add $w.pane.top $w.pane.bottom