Application Developer Guide > Using Wave Widgets > Creating a File Selection Widget
  

Creating a File Selection Widget
A file selection widget lets the user move through directories and select files. File selection widgets are created with the WwFileSelection function.
A File Selection Widget is a Popup Widget
File selection widgets are popup widgets. This means that they must have an intermediate widget, such as a button, as their parent. The popup widget appears after the user selects this intermediate button. See "File Selection Example" for more information.
Blocking vs. Nonblocking Windows
A file selection window can be blocking or nonblocking. Blocking means that no other user action can occur until the message or dialog is confirmed (user clicks on OK, Apply, Cancel, or some other confirming button). The blocking window “blocks” the user from performing other actions as long as the window remains on the screen.
A nonblocking file selection window can remain on the screen while the user performs other actions. The nonblocking window does not “block” the user from performing other actions.
The WwFileSelection function has a Block and a Nonblock keyword. Use the Block keyword to create a blocking window and the Nonblock keyword to create a nonblocking window.
File Tool Contents
The file tool lets the user move through directories, view their contents, and select files. It consists of:
*A text field where the user enters a directory name to display subdirectories and files.
*A list of directories and files.
*A text input field for displaying or editing a filename.
*The buttons: OK, Filter, Cancel, and Help.
See Figure 5-26: File Selection Widget on page 214 for an example Motif file selection box.
File Selection Example
The following example creates a button that you can click on to display a file selection widget. To run the example, enter the callback procedures in a file and compile them with the .RUN command. Then enter the widget commands at the WAVE> prompt.
FileOK and FbuttonCB are names of callback routines. The Title keyword specifies a name for the search tool. The result is shown in Figure 5-26: File Selection Widget on page 214.
Callback Procedures
PRO FbuttonCB, wid, data
file = WwFileSelection(wid,'FileOK',$
'FileCancel', Title='Search')
END
PRO FileOK, wid, shell
value = WwGetValue(wid)
PRINT, value
status = WwSetValue(shell, /Close)
END
Widget Commands
top=WwInit('ww_ex16', 'Examples', layout)
button=WwButtonBox(layout, 'File Tool', 'FbuttonCB')
status=WwSetValue(top, /Display)
WwLoop
 
Figure 5-26: File Selection Widget

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.