2 Container Widgets
container widgets
2.1 TixNoteBook
container.tex.html#2-1
2-1
(Figure 2-1) The TixNoteBook Widget
2.1.1 Adding Pages to a TixNoteBook
container.tex.html#2-2
2-2
container.tex.html#2-1
2-1
-underline
add
add
subwidget
container.tex.html#2-2
2-2
tixNoteBook .n
.n add hd  -label "Hard Disk" -underline 0
.n add net -label "Network"   -underline 0
set frame [.n subwidget hd]
tixControl $frame.access   -label "Access Time:"
tixControl $frame.write    -label "Write Throughput:"
tixControl $frame.read     -label "Read Througput:"
tixControl $frame.capacity -label "Capacity:"
pack $frame.access $frame.write $frame.read $frame.capacity
-side top -fill x
(Figure 2-2) Using The TixNoteBook Widget
2.1.2 Keyboard Accelerators
container.tex.html#2-2
2-2
-underline
<Alt-N>
<Meta-N>
<Alt-H>
<Meta-H>
2.1.3 Delaying the Creation of New Pages
add
-createcmd
container.tex.html#2-3
2-3
tixNoteBook .n
.n add hd  -label "Hard Disk" -underline 0 -createcmd CreateHd
.n add net -label "Network"   -underline 0 -createCmd CreateNet
proc CreateHd {frame} {
tixControl $frame.access   -label "Access Time:"
tixControl $frame.write    -label "Write Throughput:"
tixControl $frame.read     -label "Read Througput:"
tixControl $frame.capacity -label "Capacity:"
pack $frame.access $frame.write $frame.read $frame.capacity
-side top -fill x
}
proc CreateNet {frame} {
...
}
(Figure 2-3) Delayed Page Creation
container.tex.html#2-3
2-3
-createcmd
CreateHd
CreateHd
container.tex.html#2-3
2-3
container.tex.html#2-2
2-2
2.1.4 Changing Page Tabs and Deleting Pages
pageconfigure
.nb pageconfigure hd -label "Fixed Disk"
delete
pageconfigure
delete
2.2 PanedWindow
TixPanedWindow
container.tex.html#2-4
2-4
container.tex.html#2-4
2-4
container.tex.html#2-4
2-4
Vertical Panes
Horizontal Panes
(Figure 2-4) The TixPane Widget
2.2.1 Adding Panes Inside a TixPanedWindow Widget
tixPanedWindow
add
container.tex.html#2-5
2-5
add
-min
-max
container.tex.html#2-5
2-5
pane1
-size
pane2
-max
pane2
pane2
tixPanedWindow .p
.p add pane1 -size 100
.p add pane2 -max 300
set p1 [.p subwidget pane1]
button $p1.b1 -text Button1
button $p1.b2 -text Button2
pack $p1.b1 $p1.b2 -side left -expand yes
set p2 [.p subwidget pane2]
button $p2.b -text "Another Button"
pack $p2.b -side left -expand yes -fill both
pack .p -expand yes -fill both
(Figure 2-5) Adding Panes into a TixPanedWindow Widget
2.2.2 Putting Widgets Inside the Panes
add
container.tex.html#2-5
2-5
subwidget
container.tex.html#2-5
2-5
container.tex.html#2-6
2-6
(Figure 2-6) Output of Program
container.tex.html#2-5
2-5
2.2.3 Setting the Order of the Panes
-before
-after
add
.p add pane2 -after pane1
pane1
.p add pane2 -before pane1
pane1
2.2.4 Changing the Sizes of the Panes
paneconfigure
pane2
.p paneconfigure pane2 -size 100 -min 10
paneconfigure
2.3 The Family of Scrolled Widgets
tixScrolledListBox
tixScrolledText
2.3.1 The Scrolled Listbox Widget
tixScrolledListBox
tixScrolledListBox
hsb
vsb
listbox
subwidget
container.tex.html#2-7
2-7
listbox
.sl subwidget listbox
listbox
tixScrolledListBox .sl -scrollbar auto
set listbox [.sl subwidget listbox]
for {set x 0} {$x < 6} {incr x} {
$listbox insert end "This is item $x"
}
pack .sl -side left -expand yes -fill both
(Figure 2-7) Scrolled Listbox Widget
Scrollbars not displayed
Scrollbars displayed only when needed
(Figure 2-8) Scrolled ListBox with Automatic Scrollbars
container.tex.html#2-7
2-7
-scrollbar
auto
both
x
y
x
none
container.tex.html#2-7
2-7
container.tex.html#2-8
2-8
2.3.2 Other Scrolled Widgets
TixScrolledText
text
-scrollbar
auto
text
auto
TixScrolledWindow
window
window
container.tex.html#2-9
2-9
window
tixScrolledWindow .sw -scrollbar auto
set f [.sw subwidget window]
for {set x 0} {$x < 10} {incr x} {
frame $f.f$x
pack  $f.f$x -side top -expand yes -fill both
for {set y 0} {$y < 10} {incr y} {
entry $f.f$x.e$y -width 10
pack $f.f$x.e$y -side left -fill x
}
}
pack .sw -side left -expand yes -fill both
(Figure 2-9) Cheap Spreadsheet Application with TixScrolledWindow
TixScrolledTList
TixScrolledHList
tlist
hlist
