5 Selecting Files and Directories
File Selection Widgets
Directory Selection Widgets
5.1 File Selection Dialog Widgets
filesel.tex.html#5-2
5-2
filesel.tex.html#5-3
5-3
5.1.1 Using the TixFileSelectDialog Widget
filesel.tex.html#5-1
5-1
-title
-command
selectCmd
selectCmd
popup
tixFileSelectDialog .file -title "Select A File" -command selectCmd
.file subwidget fsbox config -pattern "*.txt" -directory /usr/info
.file popup
proc selectCmd {filename} {
puts "You have selected $filename"
}
(Figure 5-1) Using the TixFileSelectDialog
(Figure 5-2) The Composition of a TixFileSelectDialog Widget
5.1.2 The Subwidget in the TixFileSelectDialog
filesel.tex.html#5-2
5-2
fsbox
bbox
fsbox
-pattern
-directory
filesel.tex.html#5-1
5-1
-directory
fsbox
/usr/info
-pattern
txt
fsbox
-selection
cget
fsbox
-pattern
-directory
-selection
-pattern
Always remember:
5.1.3 The TixExFileSelectDialog Widget
(Figure 5-3) The ExFileSelectDialog Widget
filesel.tex.html#5-1
5-1
tixFileSelectDialog
tixExFileSelectDialog
fsbox
filesel.tex.html#5-3
5-3
fsbox
fsbox
filesel.tex.html#5-1
5-1
5.1.4 Specifying File Types for TixExFileSelectDialog
filesel.tex.html#5-3
5-3
-filetypes
filesel.tex.html#5-4
5-4
-filetypes
5.1.5 The
tix filedialog
Command
tix
filedialog
FileDialog
tixFileSelectDialog
tixExFileSelectDialog
.Xdefaults
*myapp*FileDialog: tixExFileSelectDialog
tix filedialog
tix filedialog
tixFileSelectDialog
tixExFileSelectDialog
tix
filedialog
set dialog [tix filedialog]
$dialog -title "Select A File" -command selectCmd
$dialog subwidget fsbox config -pattern "*.txt" -directory /usr/info
if {[winfo class $dialog] == "TixExFileSelectDialog"} {
$dialog subwidget fsbox config -filetypes {
{{*}            {*     -- All files}}
{{*.txt}        {*.txt -- Text files}}
{{*.c}          {*.c   -- C source files}}
}
}
$dialog popup
proc selectCmd {filename} {
puts "You have selected $filename"
}
(Figure 5-4) Using the
tix dialog
command
tix filedialog
filesel.tex.html#5-4
5-4
filesel.tex.html#5-1
5-1
filesel.tex.html#5-4
5-4
winfo
-filetypes
fsbox
5.2 Selecting Directories with the TixDirTree and TixDirList Widgets
filesel.tex.html#5-6
5-6
filesel.tex.html#5-6
5-6
-directory
-directory
/home/ioi/dev
/home/ioi/dev
-command
-browsecmd
-command
-browsecmd
filesel.tex.html#5-5
5-5
tixDirList .d -value /home/ioi/dev
-command "selectDir" -browsecmd "selectDir"
pack .d
proc selectDir {dir} {
puts "now you select $dir"
}
(Figure 5-5) Using the TixDirList widget
DirTree
DirList
(Figure 5-6) The DirTree and DirList Widgets
