4 Hierarchical Listbox
4.1 TixHList -- The Tix Hierarchical Listbox Widget
TixHList
hlist.tex.html#4-1
4-1
hlist.tex.html#4-1
4-1
Directory Tree Display
A Corporate Hierarchy
(Figure 4-1) Examples of the TixHList Widget
4.1.1 Creating a Hierarchical List
tixHList
tixScrolledHList
hlist.tex.html#4-2
4-2
tixScrolledHList
TixScrolledListBox
container.tex.html#2.3.1
2.3.1
hlist
hlist.tex.html#4-2
4-2
-options
intro.tex.html#1.3.5
1.3.5
hlist
subwidget
hlist
hlist.tex.html#4-2
4-2
tixScrolledHList .sh -options {
hlist.itemType text
hlist.drawBranch false
hlist.indent     8
}
pack .sh -expand yes -fill both
set hlist [.sh subwidget hlist]
$hlist add foo         -text "foo"
$hlist add foo.bar     -text "foo's 1st son"
$hlist add foo.bor     -text "foo's 2nd son"
$hlist add foo.bar.bao -text "foo's 1st son's 1st son"
$hlist add foo.bar.kao -text "foo's 1st son's 2nd son"
$hlist add dor         -text "dor, who has no son"
(Figure 4-2) Creating Entries in a HList Widget
(Figure 4-3) Output of Program
hlist.tex.html#4-2
4-2
4.1.2 Creating Entries in a HList Widget
entry-path
separator character
.
-separator
hlist.tex.html#4-3
4-3
foo
foo.bar
foo.bor
foo.bar.bao
add
foo
parent
foo.bar
foo.bor
foo.bar
foo.bar.bao
foo.bar
child
foo
foo
ancestor
foo.bar.bao
foo.bar.bao
descendant
foo
hlist.tex.html#4-2
4-2
hlist.tex.html#4-3
4-3
-indent
foo.bar.bao
foo.bar.kao
foo.bar
foo
foo
dor
hlist.tex.html#4-2
4-2
top-level
entries
hlist.tex.html#4-2
4-2
hlist.tex.html#4-4
4-4
set folder [tix getimage folder]
tixScrolledHList .sh -options {
hlist.separator     /
hlist.itemType      imagetext
hlist.drawBranch    true
hlist.indent        14
hlist.wideSelection false
}
pack .sh -expand yes -fill both
set hlist [.sh subwidget hlist]
foreach directory {/ /usr /usr/bin /usr/local /etc /etc/rc.d} {
$hlist add $directory -image $folder -text $directory
}
(Figure 4-4) Displaying Directories in a HList Widget
(Figure 4-5) Output of Program
hlist.tex.html#4-4
4-4
tlist.tex.html#3.2
3.2
-itemtype
add
hlist.tex.html#4-2
4-2
hlist.tex.html#4-4
4-4
-itemtype
add
4.1.3 Controlling the Layout of the Entries
-showbranch
-indent
-drawbranch
hlist.tex.html#4-5
4-5
hlist.tex.html#4-3
4-3
hlist.tex.html#4-5
4-5
hlist.tex.html#4-3
4-3
4.1.4 Handling the Selection and User Event
tlist.tex.html#3.3.5
3.3.5
info selection
selection set
selection clear
-selectmode
-browsecmd
-command
-wideselection
true
hlist.tex.html#4-3
4-3
hlist.tex.html#4-5
4-5
-wideselection
false
imagetext
hlist.tex.html#4-4
4-4
4.2 Creating Collapsible Tree Structures with TixTree
hlist.tex.html#4-7
4-7
+
-
hlist.tex.html#4-6
4-6
hlist
autosetmode
set folder [tix getimage folder]
tixTree .tree -command Command -options {
hlist.separator  /
hlist.itemType   imagetext
hlist.drawBranch true
hlist.indent     18
}
pack .tree -expand yes -fill both
set hlist [.tree subwidget hlist]
foreach directory {/ /usr /usr/bin /usr/local /etc /etc/rc.d} {
$hlist add $directory -image $folder -text $directory
}
.tree autosetmode
proc Command {entry} {
puts "you have selected $entry"
}
(Figure 4-6) Creating a Collapsible Hierarchy
(Figure 4-7) Output of Program
hlist.tex.html#4-6
4-6
hlist.tex.html#4-6
4-6
-command
-command
hlist
-command
hlist
