Tk Library Source Code

Check-in [2e4ef79bdd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tablelist: A few updates in the Programmer's Guide.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2e4ef79bdd8b9699ea5ea1434d3627d790b79859706ddbe1568dca409482ccaf
User & Date: csaba 2025-07-02 09:53:28.973
Context
2025-07-05
09:33
Tsw: Extended the file CHANGES.txt. check-in: 8e1164d322 user: csaba tags: trunk
2025-07-02
09:53
Tablelist: A few updates in the Programmer's Guide. check-in: 2e4ef79bdd user: csaba tags: trunk
09:03
Tablelist: Minor improvements in tablelistThemes.tcl. check-in: 01f87a1b5b user: csaba tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to modules/tablelist/doc/tablelist.html.
1942
1943
1944
1945
1946
1947
1948













1949
1950
1951
1952
1953
1954
1955
} else {
    set pct $tablelist::scalingpct; set sfx "gif"; set fmt "gif"
}
foreach name {clsdFolder openFolder file} {
    set imgFile $name$pct.$sfx          ;<span class="cmt"># e.g., "file.svg" or "file150.gif"</span>
    image create photo ${name}Img -file [file join $dir $imgFile] -format $fmt
}













</pre>
  </blockquote>

  <p>If the Tk version is at least 8.7 or the tksvg package can be loaded into
  the interpreter, then the three images representing a closed folder, an open
  folder, and a file, respectively, are created from the files
  <code>clsdFolder.svg</code>, <code>openFolder.svg</code>, and







>
>
>
>
>
>
>
>
>
>
>
>
>







1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
} else {
    set pct $tablelist::scalingpct; set sfx "gif"; set fmt "gif"
}
foreach name {clsdFolder openFolder file} {
    set imgFile $name$pct.$sfx          ;<span class="cmt"># e.g., "file.svg" or "file150.gif"</span>
    image create photo ${name}Img -file [file join $dir $imgFile] -format $fmt
}

<span class="cmt">#
# Helper procedures needed to work around the fact that
# on Android the directory "/" is normally not readable
#</span>
set onAndroid [expr {[info exists ::tk::android] && $::tk::android}]
proc isReadable name {
    return [expr {$::onAndroid && $name eq "/" ? 1 : [file readable $name]}]
}
proc dirContent dir {
    return [expr {$::onAndroid && $dir eq "/" ? [list /sdcard] :
            [glob -nocomplain -types {d f} -directory $dir *]}]
}
</pre>
  </blockquote>

  <p>If the Tk version is at least 8.7 or the tksvg package can be loaded into
  the interpreter, then the three images representing a closed folder, an open
  folder, and a file, respectively, are created from the files
  <code>clsdFolder.svg</code>, <code>openFolder.svg</code>, and
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
    #</span>
    set itemList {}
    if {$dir eq ""} {
        foreach volume [file volumes] {
            lappend itemList [list D[file nativename $volume] -1 D $volume]
        }
    } else {
        foreach entry [glob -nocomplain -types {d f} -directory $dir *] {
            if {[catch {file mtime $entry} modTime] != 0} {
                continue
            }

            if {[file isdirectory $entry]} {
                lappend itemList [list D[file tail $entry] -1 \
                    D[clock format $modTime -format "%Y-%m-%d %H:%M"] $entry]







|







2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
    #</span>
    set itemList {}
    if {$dir eq ""} {
        foreach volume [file volumes] {
            lappend itemList [list D[file nativename $volume] -1 D $volume]
        }
    } else {
        foreach entry [dirContent $dir] {
            if {[catch {file mtime $entry} modTime] != 0} {
                continue
            }

            if {[file isdirectory $entry]} {
                lappend itemList [list D[file tail $entry] -1 \
                    D[clock format $modTime -format "%Y-%m-%d %H:%M"] $entry]
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
        set name [lindex $item end]
        if {$name ne ""} {                                      ;<span class="cmt"># directory</span>
            $tbl rowattrib $row pathName $name

            <span class="cmt">#
            # Mark the row as collapsed if the directory is non-empty
            #</span>
            if {[file readable $name] && [llength \
                [glob -nocomplain -types {d f} -directory $name *]] != 0} {
                $tbl collapse $row
            }
        }

        incr row
    }








|
<







2141
2142
2143
2144
2145
2146
2147
2148

2149
2150
2151
2152
2153
2154
2155
        set name [lindex $item end]
        if {$name ne ""} {                                      ;<span class="cmt"># directory</span>
            $tbl rowattrib $row pathName $name

            <span class="cmt">#
            # Mark the row as collapsed if the directory is non-empty
            #</span>
            if {[isReadable $name] && [llength [dirContent $name]] != 0} {

                $tbl collapse $row
            }
        }

        incr row
    }