Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> pickfile() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    PICKFILE()

Purpose:     Pop up a directory listing from which to select a file.

Syntax:      PICKFILE( [ filespec [, top [, left [, bottom [, colors;
                       [, expanded [, showpath ]]]]]]] )

Arguments:   filespec    - Optional character string indicating the
                           filespec to use for the directory search.  This
                           filespec must follow the conventions required
                           by ADIR().  If omitted, PICKFILE() defaults to
                           all files (*.*).

             top         - Optional numeric value indicating the top row
                           for the directory box.  If omitted or an
                           invalid type parameter is specified, the
                           default row is row 6 to center the box on the
                           screen.

             left        - Optional numeric value indicating the left
                           column for the directory box.  If omitted or an
                           invalid parameter is specified, the default is
                           the column position necessary to center the
                           directory box on the screen.

             bottom      - Optional numeric value indicating the bottom
                           row for the directory box.  If omitted or an
                           invalid type parameter is specified, the
                           default row is row 19, to center the box on the
                           screen.

             colors      - Optional character string specifying the color
                           settings to use.  This color setting is passed
                           to ACHOICE() so the format is that required by
                           ACHOICE().

             expanded    - Optional logical value indicating if the file
                           listing display is to be expanded to include
                           the file size, date, and time.  If omitted or
                           an invalid parameter is passed, the default
                           value is true, display expanded listing.

             showpath    - Optional logical value indicating whether or
                           not to display the filepath specified on the
                           top of the box.  If omitted or an invalid
                           parameter is passed, the default value is
                           false.

Returns:     The selected filename as a character string, or a null string
             ("") if the Escape key was pressed.

Description: PICKFILE() is a full featured file function which provides
             easy access to a pop-up boxed file directory listing from
             which to choose a file.  PICKFILE() is very useful for
             popping up file selection menus when a user is required to
             enter a filename for a file that already exists on disk.

Notes:       After the file selection is made, the menu box disappears and
             the screen below it is restored.

             The previous version of PICKFILE() in RLIB v 2.0 would not
             return a fully qualified filename.  If you selected a file
             that was not in the current directory, only the filename was
             returned, not the full path preceding it.  This has been
             fixed in version 3.0

Example:     *-- ask user for name of .DBF file to USE
             *-- make the F10 key the pop-up controller
             SET KEY -9 TO FileLister

             *-- allocate plenty of space for fully qualified filename
             dbf_file = SPACE(60)
             @ 10,0 SAY "Enter filename or press F10 for a list";
                    GET dbf_file PICTURE "@!S40"
             READ
             USE (dbf_file)

             *--<now do whatever>


             *-----------------------------------------------------------
             * Procedure: FileLister
             * Notes:     Procedure to pop-up list of .DBF files.  This
             *            example uses the macro operator to assign the
             *            picked filename to the READVAR.  In Clipper
             *            5.0 if the READVAR() is not a PUBLIC or PRIVATE
             *            variable, this will not work.
             *-----------------------------------------------------------
             PROCEDURE FileLister
             PARAMETERS callproc, callline, inputvar
             &inputvar = STRETCH( PICKFILE("*.DBF"), LEN(&inputvar) )
             RETURN

Source:      RL_PICKF.PRG

See also:    FILEDATE(), FILESIZE(), FILETIME(), PICKREC()

See Also: FILEDATE() FILESIZE() FILETIME() PICKREC()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson