Directives 

GET_FILE_BOX

Ask for Filename

Formats

1.

Create File Box:

GET_FILE_BOX path$,dir$,title$[ex_list$[,def_ex$]][,ERR=stmtref]

2.

Check File Box:

GET_FILE_BOX READ path$,dir$,title$[ex_list$[,def_ex$]][,ERR=stmtref]

3.

Write to File Box:

GET_FILE_BOX WRITE path$,dir$,title$[ex_list$[,def_ex$]][,ERR=stmtref]

4.

Find Directory:

GET_FILE_BOX DIRECTORY path$,dir$,title$[,root$][,ERR=stmtref]

5.

Multiple Selection:

GET_FILE_BOX READ LIST path$,dir$,title$[ex_list$[,def_ex$]][,ERR=stmtref]

Where:

dir$

Initial directory to display. String expression.

def_ex$

Default file extension to use if no file extension is specified via the file extension drop box or the file path input field. Optional. String expression.

Example: "txt"

ex_list$

List of standard file extensions (e.g. .jpg, .pdf, .txt, etc.). Comma or your choice of character as the delimiter (the last extension must end with the delimiter). Optional. String expression. To define a list of file extensions along with their associated descriptions, use the format Description|*.XXX, as in the following examples:

Example: 

Applications|*.exe,Text|*.txt,PDFs|*.pdf,All|*.*,

In this list of file extensions, four descriptions are specified. Each description is associated with one file extension:

Applications (displays all .exe files)
Text (displays all .txt files)
PDFs (displays all .pdf files)
All (displays all files)

Note:
If defining only one file type, a delimiter (i.e. comma) must be added to the end. PxPlus uses this last character as the delimiter.

Text|*.txt;*.log,Images|*.png;*.bmp;*.jpg;*.jpeg,

In this list of file extensions, two descriptions are specified. Each description is associated with multiple file extensions:

Text
(displays all .txt and.log files)
Images (displays all .png, .bmp, .jpg and .jpeg files)

Note:
Use the semi-colon to separate multiple file extensions.

path$

String variable that contains the file path. Initialize this prior to executing this directive. See Note.

root$

(For Windows XP or later) Optional highest level directory in which browsing can occur. (This parameter overrides dir$.)

stmtref

Program line number or statement label to which to transfer control.

title$

Window title. String expression. If not specified, the defaults for the various formats will be used.

Note:
GET_FILE_BOX is supported when you use WindX with UNIX file systems and supported calls to [WDX]. See [WDX] Direct Action to Client Machine.

Description

Use the GET_FILE_BOX directive to display a standardized window for the user, allowing the entry or selection of a file in the system.

Format 1

Create

GET_FILE_BOX path$,dir$,title$[ex_list$[,def_ex$]][,ERR=stmtref]

Note:
The path$ variable will receive the full pathname of the file selected. Because its initial contents will be used as the default pathname, initialize it prior to executing this directive.

Use this format to select a file. If the initial directory string is null, PxPlus uses the current directory. If no title$ is supplied, the window title will read as: "File to be Opened".

Use the format Description|*.XXX, to list standard file extensions, along with their associated descriptions. You can include multiple extensions, comma-delimited (with the last extension terminated by a comma). If desired, choose a character other than a comma to delimit each entry. PxPlus uses the last character in ex_list$ (the comma or your choice) as the delimiter. See ex_list$ for examples.

Format 2

Check

GET_FILE_BOX READ path$,dir$,title$[ex_list$[,def_ex$]][,ERR=stmtref]

Use the READ format to make sure that the file you want returned exists:

get_file_box read X$,"C:\VX","File to View"

If no title$ is supplied, the window title will read as: "File to be Read".

Format 3

Write

GET_FILE_BOX WRITE path$,dir$,title$[ex_list$[,df_ex$]][,ERR=stmtref]

Use the WRITE format to save or rewrite the file. If you do this and a user selects a file that already exists, PxPlus will confirm that the file is to be overwritten prior returning to the program:

get_file_box write X$,lwd,"Report file","Report files|*.RPT,All files|*.*,","RPT"

This allows the user to have a filename with the default extension .RPT and gives the user a list of files of two types - report files (*.RPT) and All files (*.*).

If no title$ is supplied, the window title will read as: "File to be Written".

Format 4

Directory

GET_FILE_BOX DIRECTORY path$,dir$,title$[,root$][,ERR=stmtref]

Use the DIRECTORY format to return a directory name to the application. The system will only allow the user to select a directory starting with directory set in dir$.

If no title$ is supplied, the window title will read as: "Browse for Folder".

(For Windows XP or later) The optional root$ parameter sets the highest level directory in which browsing can occur (overriding what is set in dir$). When not using WindX or iNomads, then the terms "My Computer" and "My Documents" can be used, as well as the full path to an existing folder.

Format 5

Multiple Selection

GET_FILE_BOX READ LIST path$,dir$,title$[ex_list$[,df_ex$]][,ERR=stmtref]

Use the LIST format to specify multiple selections for GET_FILE_BOX READ. If a single entry is selected, then path$ will contain the full path of the file (as with a GET_FILE_BOX READ). If more than one entry is selected, then path$ will consist of the full directory where the files are located terminated by SEP, followed by a delimited list of the selected files where the delimiter is defined by the 'GS' parameter.

If no title$ is supplied, the window title will read as: "File to be Read".

Note:
Windows ignores selected directories. This format is not supported in the text version of GET_FILE_BOX.

See Also

GET_FILE_BOX File Selection Dialog