Next: The TixExFileSelectDialog Widget Up: File Selection Dialog Previous: Using the TixFileSelectDialog

 

The Subwidget in the TixFileSelectDialog 

We may also want to set other options for the file dialog such as its file filter and working directory. To do this, we must know the composition of the TixFileSelectDialog widget. As shown in figure 5-2, the TixFileSelectDialog contains a subwidget fsbox of the type TixFileSelectBox and a subwidget bbox of the type TixStdButtonBox.

The fsbox subwidget supports the -pattern and -directory options. At line 2 of figure 5-1, we use the -directory option to tell the fsbox subwidget to display files in the directory /usr/info; we also use the -pattern option to specify we only want the filenames that has the txt extension.

The fsbox subwidget also supports the -selection option, which stores the filename currently selected by the user. We can query this value by the cget widget command of the fsbox subwidget.

Remember that the -pattern, -directory and -selection options do not belong to the TixFileSelectDialog widget. A common mistake that people make is to try to configure the non-existent -pattern option of the TixFileSelectDialog, which causes much despair, long error messages and great loss of self-confidence. Always remember:, when you want to configure an option, find out whether it belongs to the widget or its subwidgets.


http://tix.sourceforge.net