PICK-FILENAME Action

This document covers the following topics:


Description

Invokes a standard dialog box that allows the end user to pick the name of a file which is optionally assigned to a Natural work file number.

Parameters

Name/Data Type Explanation
Title (A253) Input

The text displayed in the title bar of the dialog box.

Init (A253) Input

A string pattern ( [directoryname \ ][filename[.extension]] ) that determines the initial directory (if specified), together with either the files to choose from (if the filter list parameter is not specified) or the pre-selected file (if a filename and extension containing no wildcard characters (*,?) is used). If the pattern is an empty string, all files of the current directory are listed.

Work file number (I4) Input

The work file number to which the selected file name is to be assigned. If this parameter is "0", the file name is not assigned to a work file number.

File name (A253) Output

Returns the selected file name with the entire path name.

Dialog Type (I4) Input (optional parameter)

Determines type of file selection dialog displayed: 0 (default) = 'Open' dialog (new files allowed); 1 = 'Open' dialog (selected file must exist); 2 = 'Save' dialog.

Filter list

(A253/*)

Input (optional parameter)

A one-dimensional array containing pre-specified display filter definitions. The array does not need to be filled entirely. Each filter definition is represented by a pair of array elements. The first element of each pair is a textual description of the filter used for display in the file selection dialog. The second element of each pair is the associated display filter pattern. The display filter pattern may be complex, consisting of multiple components separated by a semi-colon. 

Filter index

(I4)

Input (optional parameter)

The index of the filter to be initially used when the file selection dialog is first opened. 0 = first filter, 1 = second filter , and so on.

Response (I4) Output

Natural error (if applicable).

Example:

 
DEFINE DATA LOCAL 
   1 #RESPONSE (I4) 
   1 #MYTITLE (A253) 
   1 #SELECTNAME (A253) 
   1 #FILTER (A32/6) CONST 
     < 
       'Private resource files', '*.nr*', 
       'Shared resource files',  '*.bmp;*.ico;*.hlp;*.neo;*.rpt',
       'All Files (*.*)',        '*.*' 
     > 
   END-DEFINE 
   ... 
   #MYTITLE := 'Example using implicit display filter' 
   PROCESS GUI ACTION PICK-FILENAME WITH #MYTITLE 'c:\*.*' 0 
   #SELECTNAME GIVING #RESPONSE 
   #IF-1.STRING := #SELECTNAME 
   *
   #MYTITLE := 'Example using explicit display filter'
   PROCESS GUI ACTION PICK-FILENAME WITH #MYTITLE 'd:\fuser\mylib\res\'
     0 #SELECTNAME 0 #FILTER(*) 1 GIVING #RESPONSE 
   #IF-2.STRING := #SELECTNAME