4 # --------------------------------------------------------------------------
5 # Starting with Tcl 8.x, the BLT commands are stored in their own
6 # namespace called "blt". The idea is to prevent name clashes with
7 # Tcl commands and variables from other packages, such as a "table"
8 # command in two different packages.
10 # You can access the BLT commands in a couple of ways. You can prefix
11 # all the BLT commands with the namespace qualifier "blt::"
14 # blt::table . .g -resize both
16 # or you can import all the command into the global namespace.
18 # namespace import blt::*
20 # table . .g -resize both
22 # --------------------------------------------------------------------------
23 if { $tcl_version >= 8.0 } {
24 namespace import blt::*
25 namespace import -force blt::tile::*
27 source scripts/demo.tcl
29 proc AddDirEntries { w dir } {
30 if { [file isdirectory $dir] } {
31 set files [glob -nocomplain $dir/*]
32 eval $w insert end [lsort $files]
33 set subdirs [glob -nocomplain $dir/*/]
34 eval $w entry configure [lsort $subdirs] -button yes
39 foreach f [glob ./images/mini-*.gif] {
40 lappend imageList [image create photo -file $f]
43 image create photo openFolder -file images/open.gif
44 image create photo closeFolder -file images/close.gif
45 option add *Hierbox.icons "closeFolder openFolder"
47 #option add *Hierbox.openCommand { AddDirEntries %W "$top/%P" }
48 #option add *Hierbox.closeCommand { eval %W delete %n 0 end }
53 -yscrollcommand { .vs set } \
54 -xscrollcommand { .hs set }
56 scrollbar .vs -orient vertical -command { .h yview }
57 scrollbar .hs -orient horizontal -command { .h xview }
58 button .test -text Test -command {
59 set index [.h curselection]
60 set names [eval .h get -full $index]
61 puts "selected names are $names"
69 table configure . c1 r1 r2 -resize none
72 .h configure -separator "/" -trim $top -autocreate yes
73 #.h entry configure 0 -label [file tail $top]
75 catch { exec du $top } files
76 foreach f [split $files \n ] {
77 .h insert end [lindex $f 1] -text [lindex $f 0] -button auto