.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "FileSelect 3" .TH FileSelect 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Tk::FileSelect \- a widget for choosing files .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& 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 \& FileSelect. \& $FSref\->configure(option => value[, ...]) \& Please see the Populate subroutine as the configuration \& list changes rapidly. .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" 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. .PP 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. .SH AUTHORS .IX Header "AUTHORS" Based on original FileSelect by Klaus Lichtenwalder, Lichtenwalder@ACM.org, Datapat GmbH, Munich, April 22, 1995 adapted by Frederick L. Wagner, derf@ti.com, Texas Instruments Incorporated, Dallas, 21Jun95 .SH HISTORY .IX Header "HISTORY" .SS "950621 \-\- The following changes were made:" .IX Subsection "950621 -- The following changes were made:" .IP \(bu 4 Rewrote Tk stuff to take advantage of new Compound widget module, so FileSelect is now composed of 2 LabEntry and 2 ScrlListbox2 subwidgets. .IP \(bu 4 Moved entry labels (from to the left of) to above the entry fields. .IP \(bu 4 Caller is now able to control these aspects of widget, in both FileSelect (new) and configure : .Sp (Please see subroutine Populate for details, as these options change rapidly!) .IP \(bu 4 I changed from Double\-Button\-1 to Button\-1 in the Files listbox, to work with multiple mode in addition to browse mode. I also made some name changes (LastPath \-\-> saved_path, ...). .IP \(bu 4 The show method is not yet updated. .IP \(bu 4 The topLevel stuff is not done yet. I took it out while I toy with the idea of FileSelect as a subwidget. Then the 'normal' topLevel thing with Buttons along the bottom could be build on top of it. .IP \(bu 4 By request of Henry Katz , I added the functionality of using the Directory entry as a filter. So, if you want to only see the *.c files, you add a .c (the *'s already there :) and hit return. .SS "95/10/17, SOL, LUCC. lusol@Lehigh.EDU" .IX Subsection "95/10/17, SOL, LUCC. lusol@Lehigh.EDU" .IP \(bu 4 .Sp .Vb 1 \& Allow either file or directory names to be accepted. .Ve .IP \(bu 4 Require double click to move into a new directory rather than a single click. This allows a single click to select a directory name so it can be accepted. .IP \(bu 4 Add \-verify list option so that standard Perl file test operators (like \&\-d and \-x) can be specified for further name validation. The default value is the special value '!\-d' (not a directory), so any name can be selected as long as it's not a directory \- after all, this IS FileSelect! .Sp For example: .Sp .Vb 1 \& $fs\->configure(\-verify => [\*(Aq\-d\*(Aq, [\e&verify_code, $P1, $P2, ... $Pn]]); .Ve .Sp ensures that the selected name is a directory. Further, if an element of the list is an array reference, the first element is a code reference to a subroutine and the remaining optional elements are its parameters. The subroutine is called like this: .Sp .Vb 1 \& &verify_code($cd, $leaf, $P1, $P2, ... $Pn); .Ve .Sp where \f(CW$cd\fR is the current directory, \f(CW$leaf\fR is a directory or file name, and \&\f(CW$P1\fR .. \f(CW$Pn\fR are your optional parameters. The subroutine should return TRUE if success or FALSE if failure. .SS "961008 \-\- derf@ti.com :" .IX Subsection "961008 -- derf@ti.com :" 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. .SH "SEE ALSO" .IX Header "SEE ALSO" Tk::getOpenFile, Tk::FBox.