File List Box

 

A File List Box is a file selection list box. This will allow the user to select a file from any directory or drive on the system.

 

In combination with the File List Box, you can include an Edit Box control which has the same variable named in the controls Variable attribute, as the File List Box. If you do, the user can type a file mask into the edit Box (e.g., "*.TXT"), which will cause the File List Box to be redrawn to display only those files which match the specified file mask.

 

Also in combination with the File List Box, you can include a Variable Text control which has the same variable named in the controls Variable attribute, as the File List Box. If you do, this control will show the name of the directory currently displayed in the File List Box.

 

For File List Boxes, "text" should be DEFAULT.

 

Normally, when a dialog box opens, File List Boxes display files matching a file mask of "*.*" (i.e., all files). You can change this by assigning a different file mask value to the variable before calling the Dialog function.

 

Set your variable to display a directory path and file mask. i.e.

 

wbtfiles="C:\WINBATCH\*.WBT"

 

Upon returning the value of the variable will be set to the selected filename; if you need to know what directory the file is in, use the DirGet function after the Dialog exits.

 

For multiple selections or to display pre-defined lists, use the Dialog Editor's Item List Box or Drop-down Combo Box option.

 

Note: When File List Box is used, the dialog editor assumes that a file must be chosen before it proceeds. Add the following WIL command to the top of your script if you wish to allow the dialog to proceed without a file selection.

 

IntControl(4, 0,0,0,0)

 

When no file is selected, the return value of the filename variable is:

 

"NOFILESELECTED"

 

For more information on IntControl, see the Windows Interface Language help file.

 

Note: You can have only one File List Box in a dialog.

 

image\filelb.gif

 

Control Attributes

 

Calendar

Check Box

Com Control

DateTime

Drop-down Combo Box

Edit Box

File List Box

Group Box

Item List Box

Menu Bar

Menu Item

Multiline Edit Box

Picture

Picture Button

Push Button

Radio Button

Report View

Spinner

Static Text

Variable Text

 

For example, the line in the script generated by the WIL Dialog Editor may look like:

 

FileListBox003=`011,059,128,080,FILELISTBOX,"FileListBox_1",inifiles,DEFAULT,DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

 

In the example code below, notice that the variable 'inifiles' is used for the control attributes Variable Text, Edit Box and File List Box.