GETFILE( ) Function

JavaScript Editor js editor     Web development 



Main Page

Displays the Open dialog box.

GETFILE([cFileExtensions] [, cText] [, cOpenButtonCaption]
   [, nButtonType] [, cTitleBarCaption])

Parameters

cFileExtensions


Specifies the file name extensions for the files to display in the Open dialog box when the All Files type is not chosen. When passing a value as a literal, enclose it with quotation marks (""). Do not include a period (.) in front of file name extensions.
Note:
The cFileExtensions parameter cannot exceed 254 characters in length.

cFileExtensions can take a variety of forms:
  • If cFileExtensions contains a single extension, for example, "prg", the Open dialog box displays only those file names with that extension.

  • If cFileExtensions is the empty string, the Open dialog box displays all files in the current directory.

  • cFileExtensions can contain wildcard characters such as * and ?. The Open dialog box displays all file names with extensions that meet the wildcard criteria. For example, if cFileExtensions is "?X?", the Open dialog box displays all file names with the extension .fxp, .exe, and .txt.

  • cFileExtensions can contain a file description followed by a file extension or a list of file extensions separated with commas. The file description appears in the Open dialog box in the Files of Type list. Separate the file description from the file extension or list of file extensions with a colon (:). Separate multiple file descriptions and their file extensions with a semicolon (;).

    For example, if cFileExtensions is "Text:TXT", the Open dialog box displays the file description "Text" in the Files of Type list and displays all files with a .txt extension.

    If cFileExtensions is "Tables:DBF; Files:TXT,BAK" the file descriptions "Tables" and "Files" appear in the Files of Type list. When "Tables" is chosen from the Files of Type list, all files with a .dbf extension are displayed. When "Files" is chosen from the Files of Type list, all files with .txt and .bak extensions are displayed.

  • If cFileExtensions contains just a semicolon (";"), the Open dialog box displays all files without extensions.

cText


Specifies text to display for the File Name label in the Open dialog box.
cOpenButtonCaption


Specifies a caption for the OK button in the Open dialog box.
nButtonType


Specifies the number and type of buttons that appear in the Open dialog box. The following table lists the values for nButtonType.

nButtonType Buttons displayed

0 (or omitted)

OK, Cancel

1

OK, New, Cancel

2

OK, None, Cancel

Note:
GETFILE(В ) returns the string "Untitled" with the path specified in the Open dialog box when nButtonType is set to 1 and the user clicks New, or when nButtonType is set to 2 and the user clicks None.

cTitleBarCaption


Specifies the caption for the title bar of the Open dialog box.

Return Value

Character. GETFILE(В ) returns the name of the file chosen in the Open dialog box or the empty string if the user closes the Open dialog box by pressing ESC, clicking Cancel or the Close button on the Open dialog box.

Remarks

Example

В Copy Code
CLOSE DATABASES
SELECT 0

gcTable=GETFILE('DBF', 'Browse or Create a .DBF:', 
   'Browse', 1, 'Browse or Create')
DO CASE
   CASE 'Untitled' $ gcTable
      CREATE (gcTable)
   CASE EMPTY(gcTable)
      RETURN
   OTHERWISE
      USE (gcTable)
      BROWSE
ENDCASE

See Also



JavaScript Editor js editor     Web development