1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#!../bltwish
source bltDemo.tcl
proc AddDirEntries { w dir } {
if { [file isdirectory $dir] } {
set files [glob -nocomplain $dir/*]
eval $w insert end [lsort $files]
set subdirs [glob -nocomplain $dir/*/]
eval $w entry configure [lsort $subdirs] -button yes
}
}
image create photo activeIcon -file ./images/ofolder.gif
image create photo normalIcon -file ./images/folder.gif
image create photo openGadget -file ./images/mini-book2.gif
image create photo closeGadget -file ./images/mini-book1.gif
image create photo bgTexture -file ./images/rain.gif
set imageList {}
foreach f [glob ./images/mini-*.gif] {
lappend imageList [image create photo -file $f]
}
#option add *Hierbox.Tile bgTexture
option add *Hierbox.TileOffset yes
#option add *forceGadgets no
#option add *Hierbox.openCommand {
# AddDirEntries %W "$top/%P"
#}
#option add *Hierbox.closeCommand {
# eval %W delete %n 0 end
#}
option add *icons "normalIcon activeIcon"
hierbox .h \
-allowduplicates no \
-hideroot yes \
-yscrollcommand { .vs set } \
-xscrollcommand { .hs set }
scrollbar .vs -orient vertical -command { .h yview }
scrollbar .hs -orient horizontal -command { .h xview }
button .test -text Test -command {
set index [.h curselection]
set names [eval .h get -full $index]
puts "selected names are $names"
}
table . \
0,0 .h -fill both \
0,1 .vs -fill y \
1,0 .hs -fill x \
table configure . c1 r1 r2 -resize none
set top ../
.h configure -separator "/" -trim $top -autocreate yes
#.h entry configure 0 -label [file tail $top]
catch { exec du $top } files
foreach f [split $files \n ] {
.h insert end [lindex $f 1] -text [lindex $f 0] -button auto
}
focus .h
|