Slaven Rezić > Tk-804.031_503 > Tk::FileSelect



Annotate this POD


New  34
Open  59
Stalled  15
View/Report Bugs
Module Version: 4.018   Source   Latest Release: Tk-804.033


Tk::FileSelect - a widget for choosing files


 use Tk::FileSelect;

 $FSref = $top->FileSelect(-directory => $start_dir);
               $top            - a window reference, e.g. MainWindow->new
               $start_dir      - the starting point for the FileSelect
 $file = $FSref->Show;
               Executes the fileselector until either a filename is
               accepted or the user hits Cancel. Returns the filename
               or the empty string, respectively, and unmaps the
 $FSref->configure(option => value[, ...])
               Please see the Populate subroutine as the configuration
               list changes rapidly.


This Module pops up a Fileselector box, with a directory entry on top, a list of directories in the current directory, a list of files in the current directory, an entry for entering/modifying a file name, an accept button and a cancel button.

You can enter a starting directory in the directory entry. After hitting Return, the listboxes get updated. Double clicking on any directory shows you the respective contents. Single clicking on a file brings it into the file entry for further consideration, double clocking on a file pops down the file selector and calls the optional command with the complete path for the selected file. Hitting return in the file selector box or pressing the accept button will also work. *NOTE* the file selector box will only then get destroyed if the file name is not zero length. If you want yourself take care of it, change the if(length(.. in sub accept_file.


Based on original FileSelect by Klaus Lichtenwalder,, Datapat GmbH, Munich, April 22, 1995 adapted by Frederick L. Wagner,, Texas Instruments Incorporated, Dallas, 21Jun95


950621 -- The following changes were made:

95/10/17, SOL, LUCC. lusol@Lehigh.EDU

961008 -- :

By request of Jim Stern <> and Brad Vance <>, I updated the Accept and Show functions to support selection of multiple files. I also corrected a typo in the -verify code.


Tk::getOpenFile, Tk::FBox.

syntax highlighting: