1FileSelect(3)         User Contributed Perl Documentation        FileSelect(3)
2
3
4

NAME

6       Tk::FileSelect - a widget for choosing files
7

SYNOPSIS

9        use Tk::FileSelect;
10
11        $FSref = $top->FileSelect(-directory => $start_dir);
12                      $top            - a window reference, e.g. MainWindow->new
13                      $start_dir      - the starting point for the FileSelect
14        $file = $FSref->Show;
15                      Executes the fileselector until either a filename is
16                      accepted or the user hits Cancel. Returns the filename
17                      or the empty string, respectively, and unmaps the
18                      FileSelect.
19        $FSref->configure(option => value[, ...])
20                      Please see the Populate subroutine as the configuration
21                      list changes rapidly.
22

DESCRIPTION

24       This Module pops up a Fileselector box, with a directory entry on top,
25       a list of directories in the current directory, a list of files in the
26       current directory, an entry for entering/modifying a file name, an
27       accept button and a cancel button.
28
29       You can enter a starting directory in the directory entry. After hit‐
30       ting Return, the listboxes get updated. Double clicking on any direc‐
31       tory shows you the respective contents. Single clicking on a file
32       brings it into the file entry for further consideration, double clock‐
33       ing on a file pops down the file selector and calls the optional com‐
34       mand with the complete path for the selected file.  Hitting return in
35       the file selector box or pressing the accept button will also work.
36       *NOTE* the file selector box will only then get destroyed if the file
37       name is not zero length. If you want yourself take care of it, change
38       the if(length(.. in sub accept_file.
39

AUTHORS

41       Based on original FileSelect by Klaus Lichtenwalder, Lichten‐
42       walder@ACM.org, Datapat GmbH, Munich, April 22, 1995 adapted by Freder‐
43       ick L. Wagner, derf@ti.com, Texas Instruments Incorporated, Dallas,
44       21Jun95
45

HISTORY

47       950621 -- The following changes were made:
48
49       ·   Rewrote Tk stuff to take advantage of new Compound widget module,
50           so FileSelect is now composed of 2 LabEntry and 2 ScrlListbox2 sub‐
51           widgets.
52
53       ·   Moved entry labels (from to the left of) to above the entry fields.
54
55       ·   Caller is now able to control these aspects of widget, in both
56           FileSelect (new) and configure :
57
58           (Please see subroutine Populate for details, as these options
59           change rapidly!)
60
61       ·   I changed from Double-Button-1 to Button-1 in the Files listbox, to
62           work with multiple mode in addition to browse mode.  I also made
63           some name changes (LastPath --> saved_path, ...).
64
65       ·   The show method is not yet updated.
66
67       ·   The topLevel stuff is not done yet.  I took it out while I toy with
68           the idea of FileSelect as a subwidget.  Then the 'normal' topLevel
69           thing with Buttons along the bottom could be build on top of it.
70
71       ·   By request of Henry Katz <katz@fs09.webo.dg.com>, I added the func‐
72           tionality of using the Directory entry as a filter. So, if you want
73           to only see the *.c files, you add a .c (the *'s already there :)
74           and hit return.
75
76       95/10/17, SOL, LUCC.  lusol@Lehigh.EDU
77
78       ·
79            Allow either file or directory names to be accepted.
80
81       ·   Require double click to move into a new directory rather than a
82           single click.  This allows a single click to select a directory
83           name so it can be accepted.
84
85       ·   Add -verify list option so that standard Perl file test operators
86           (like -d and -x) can be specified for further name validation.  The
87           default value is the special value '!-d' (not a directory), so any
88           name can be selected as long as it's not a directory - after all,
89           this IS FileSelect!
90
91           For example:
92
93               $fs->configure(-verify => ['-d', [\&verify_code, $P1, $P2, ... $Pn]]);
94
95           ensures that the selected name is a directory.  Further, if an ele‐
96           ment of the list is an array reference, the first element is a code
97           reference to a subroutine and the remaining optional elements are
98           it's parameters.  The subroutine is called like this:
99
100               &verify_code($cd, $leaf, $P1, $P2, ... $Pn);
101
102           where $cd is the current directory, $leaf is a directory or file
103           name, and $P1 .. $Pn are your optional parameters.  The subroutine
104           should return TRUE if success or FALSE if failure.
105
106       961008 -- derf@ti.com :
107
108       By request of Jim Stern <js@world.northgrum.com> and Brad Vance
109       <bvance@ti.com>, I updated the Accept and Show functions to support
110       selection of multiple files.  I also corrected a typo in the -verify
111       code.
112
113
114
115perl v5.8.8                       2008-02-05                     FileSelect(3)
Impressum