Itcl File-selector Box Widget

The fileselector widget class provides a Motif-like file selector dialog box which can be used to prompt the user for a file name.

Synopsis

fileselector pathName ?options?
create a new file selector widget named pathName.
pathName option ?args...?
manipulate the file selector widget named pathName.

Options

The fileselector class provides the same options as the dialog class, and additionally:

Name: foreground
Class: Foreground
Command-Line Switch: -foreground
Default: black
The foreground colour of the sub-widgets in the dialog box.

Name: background
Class: Background
Command-Line Switch: -background
Default: #ccc
The background colour of the sub-widgets in the dialog box.

Name: N/A
Class: N/A
Command-Line Switch: -mode
Default: read
The mode in which the file-selector is operating. If set to write the file-selector assumes that the user is writing a new file and so will allow the user to create new directories. If set to read (the default), the file-selector assumes that the user is reading in an existing file and so will not allow the user to create new directories.

Name: filter
Class: Filter
Command-Line Switch: -filter
Default: *
A glob-style filter used to select which files to display in the scrolled list. If the filter is a path name, then files in the directory part of the path will be displayed.

Name: setCwd
Class: SetCwd
Command-Line Switch: -setcwd
Default: 1
The file-selector changes the current working directory of the process which created it as the user moves between directories. If the setCwd option is set to 1 (the default), then the file-selector leaves the current working directory as that which the user finally selected. If set to 0, when the user presses the "Ok" button, the file-selector changes the current working directory back to the directory which was current when it was created. The former mode is useful when loading or saving files - the user will probably want to continue working in that directory. The latter mode is useful when inserting files - the user will probably want to continue working in the directory in which the main file exists. Pressing the "Cancel" button will always change the current working directory back that what it was when the file-selector was created.

Name: file
Class: File
Command-Line Switch: -file
Default: ""
The default file-name. This value is in the "File" entry when the file-selector appears. It is an error for this option to be a path-name (ie: contain "/" characters).

Name: scrollbar
Class: Scrollbar
Command-Line Switch: -scrollbar
Default: right
The side on which scrollbars are positioned. This is either left or right (the default).

Name: okButton
Class: OkButton
Command-Line Switch: -okbutton
Default: Ok
The text displayed in the "Ok" button.

Name: cancelButton
Class: CancelButton
Command-Line Switch: -cancelbutton
Default: Cancel
The text displayed in the "Cancel" button.

Name: filterButton
Class: FilterButton
Command-Line Switch: -filterbutton
Default: Filter
The text displayed in the "Filter" button.

Name: N/A
Class: N/A
Command-Line Switch: -okcommand
Default: ""
The command to be evaluated when the "Ok" button is pressed. This command is appended with the full path-name of the selected file before being evaluated.

Name: N/A
Class: N/A
Command-Line Switch: -cancelcommand
Default: ""
The command to be executed when the "Cancel" button is pressed. This command is not appended with a file name.

Widget Command

The fileselector class provides the same operations as the dialog class:

pathName configure ?options...?
Configure the widget.

pathName center ?window?
Center the dialog relative to the given window. If no window is given, the dialog is centered relative to the root window.


Nat Pryce (np2@doc.ic.ac.uk)