Next: The Subwidget in Up: File Selection Dialog Previous: File Selection Dialog

### Using the TixFileSelectDialog Widget

An example of using the TixFileSelectDialog widget is in figure 5-1 . At line 1, we create a TixFileSelectDialog widget and set the title of the dialog to ``Select A File'' using the `-title` option. We also use the `-command` option to specify that the procedure `selectCmd` should be called when the user has selected a file. `selectCmd` will be called with one parameter, the filename selected by the user. When the TixFileSelectDialog widget is created, it is initially not shown on the screen. Therefore, at line 3, we call its `popup` widget command to place the widget on the screen.

`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