GETFNAME Examples


Example 1:

 

*

 

 

.GETFNAME Example Program

.

 

 

NAME

INIT

"TEDIT.PLS"

PATH

INIT

"C:\Sunbelt\DEMO"

REPLY

DIM

1

.

 

 

  

GETFNAME

OPEN,"Open Test", NAME,PATH,"PLS"

  

IF

NOT OVER

  

DISPLAY

*HD,*R,"File name returned: ":

  

  

Name," Path: ",PATH," ";

  

KEYIN

REPLY;

  

ELSE

 

  

KEYIN

*HD,*R,"Dialog canceled...",REPLY;

  

ENDIF

 

 

This example creates an Open dialog with the default name set to TEDIT.PLS. It starts the search on drive C in the Sunbelt\DEMO directory. The file filter is set to "*.PLS". Once a file is selected the name and extension is returned in the variable NAME and the selected path is returned in the variable PATH. If the user cancels the dialog, the OVER flag is set.

 

Example 2:

 

$OPEN$

FORM

"1"

$PREP$

FORM

"2"

$O_FILTER$

FORM

"17" ;0x11 OPEN with user FILTER

$P_FILTER$

FORM

"18" ;0x12 PREP with user FILTER

$O_MULTI$

FORM

"33" ;0x21 OPEN with MULTISELECT

$P_MULTI$

FORM

"34" ;0x22 PREP with MULTISELECT

$O_FIL_MUL$

FORM

"49" ;0x31 OPEN FILTER/MULTISELECT

$P_FIL_MUL$

FORM

"50" ;0x32 PREP FILTER/MULTISELECT

.

 

 

PROMPT

INIT

"Select File(s)"

NAME

DIM

50

PATH

DIM

50

FILTER

INIT

"Pls,":

  

  

"MySource(*.pls;*.dbs),": ;1st comment

  

  

"*.pls;*.dbs,": ;1st filter

  

  

"MyPict(*.pcx),": ;2nd comment

  

  

"*.pcx" ;2nd filter

.

  

 

  

MOVE

"somename.pls",NAME

  

PATH

CHANGE,"c:\default\path"

  

GETFNAME

TYPE=$O_FILTER$,PROMPT,NAME,PATH,FILTER

 

 



PL/B Language Reference GETFILE Example GETITEM Examples