WwPickFile Function
A convenience routine to easily create a modal file selection dialog that blocks until a file name has been selected. This routine will not return until a file name is selected or the Cancel button is pressed.
Usage
filename = WwPickFile(parent[, HelpCallback ] )
Input Parameters
parent — The widget ID of the parent.
HelpCallback — (Optional) A string containing the name of the callback routine that is called when the Help button is selected. The Help keyword can be used instead of the parameter.
Returned Value
filename — A string containing the name of the file selected. If the Cancel button was selected a null string (‘’) is returned.
Keywords
Dir — Specifies a string containing the directory path.
File — Specifies a string containing the default file selection.
Help — Use this keyword to specify a help topic when the HelpCallback parameter is not specified. This keyword can specify a two-element or one-element string array. If it is a two-element array, the first element is the name of a help topic and the second is the filename of the help file containing the topic. A one-element array specifies only the name of a help topic. In this case the default help file is used. For information on the location of the default help file, refer to the HELP command. The specified help topic is displayed in the online help viewer when the Help button is pressed.
Name — A string containing the name of the file selection box widget. The Name specified is the widget name used as part of the resource specification. (Default: file.)
Pattern — Specifies the search pattern used in combination with the directory in determining files to be displayed.
Position — Specifies the position of the upper-left corner of the file selection window on the screen in pixels.
Shell_name — Specifies the name of the TopLevelShell container widget used to hold the file selection box widget. The Shell_name specified is the top-level widget shell name used as part of the resource specification. (Default: fileshell.)
Title — Specifies a string containing the file selection widget’s title.
Background — Specifies the background color name.
Font — Specifies the name of the font used for text.
MSFont — Adds support for Windows fonts.
Foreground — Specifies the foreground color name.
Discussion
The Block and NonBlock keywords found in the WwFileSelection widget are not available. Because of the method that is used to process widget events and return the filename, multiple instances of this dialog cannot exist. For this reason, the dialog always blocks.
Example
PRO ButtonCB, wid, data
file = WwPickFile(wid, Dir=!Data_dir)
PRINT, file
END
PRO wwpickfile_ex1
top = WwInit('wwpickfile_ex1', 'wwpickfile_ex1', layout)
button = WwButtonBox(layout, 'Select a File...', 'ButtonCB')
status = WwSetValue(top, /Display)
WwLoop
END