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
30       hitting Return, the listboxes get updated. Double clicking on any
31       directory shows you the respective contents. Single clicking on a file
32       brings it into the file entry for further consideration, double
33       clocking on a file pops down the file selector and calls the optional
34       command with the complete path for the selected file.  Hitting return
35       in 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,
42       Lichtenwalder@ACM.org, Datapat GmbH, Munich, April 22, 1995 adapted by
43       Frederick L. Wagner, derf@ti.com, Texas Instruments Incorporated,
44       Dallas, 21Jun95
45

HISTORY

47   950621 -- The following changes were made:
48       ·   Rewrote Tk stuff to take advantage of new Compound widget module,
49           so FileSelect is now composed of 2 LabEntry and 2 ScrlListbox2
50           subwidgets.
51
52       ·   Moved entry labels (from to the left of) to above the entry fields.
53
54       ·   Caller is now able to control these aspects of widget, in both
55           FileSelect (new) and configure :
56
57           (Please see subroutine Populate for details, as these options
58           change rapidly!)
59
60       ·   I changed from Double-Button-1 to Button-1 in the Files listbox, to
61           work with multiple mode in addition to browse mode.  I also made
62           some name changes (LastPath --> saved_path, ...).
63
64       ·   The show method is not yet updated.
65
66       ·   The topLevel stuff is not done yet.  I took it out while I toy with
67           the idea of FileSelect as a subwidget.  Then the 'normal' topLevel
68           thing with Buttons along the bottom could be build on top of it.
69
70       ·   By request of Henry Katz <katz@fs09.webo.dg.com>, I added the
71           functionality of using the Directory entry as a filter. So, if you
72           want to only see the *.c files, you add a .c (the *'s already there
73           :) and hit return.
74
75   95/10/17, SOL, LUCC.  lusol@Lehigh.EDU
76       ·
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
96           element of the list is an array reference, the first element is a
97           code reference to a subroutine and the remaining optional elements
98           are its 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       By request of Jim Stern <js@world.northgrum.com> and Brad Vance
108       <bvance@ti.com>, I updated the Accept and Show functions to support
109       selection of multiple files.  I also corrected a typo in the -verify
110       code.
111

SEE ALSO

113       Tk::getOpenFile, Tk::FBox.
114
115
116
117perl v5.32.0                      2020-07-28                     FileSelect(3)
Impressum