OSDN Git Service

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