Example: File Viewer (5)
# Gets called on single clicks on an item in the tlist
proc ListBrowse {index} {
global stlist stext
set tlist [$stlist subwidget tlist]
set text [$stext subwidget text]
set file [$tlist entrycget $index -text]
if ![file isdirectory $file] {
# Shows the first 1000 bytes of the file
set fd [open $file {RDONLY}]
$text delete 1.0 end
$text insert end [read $fd 1000]
close $fd
}
}