Programming Guide



sm_jfilebox

Opens a file selection dialog box

int sm_jfilebox(char *selection, char *path, char *file_mask, char *title, int open_save);

selection
A local or global JPL variable, widget, or property to get the selected file's name.

path
The initial path for the directory tree. If you supply an empty string, the dialog box initially shows the directory in which the Panther application was launched.

file_mask
A filter to narrow down the display of files in path. Use at least one wildcard character. For example, to narrow down the display to all files that have the extension doc, supply "*.doc" as the argument.

To show all files, supply an empty string.

title
The text of the dialog box's title. Supply an empty string to suppress title display.

open_save
Valid only for Windows, determines the title of the file type option menu; ignored by other platforms. The title is platform-specific; for example, in Windows, FB_OPEN sets the title to List Files of Type.

Returns

Description

sm_jfilebox invokes a file selection box that lets users choose a file to open or save a file. On GUI platforms, Panther uses the GUI's standard file selection dialog. The dialog box initially displays the contents of the path-specified directory, and lists files that match the wildcard specification in file_mask. Users can browse through the directory tree. When the user chooses OK, Panther copies to selection the name of the file to open or save.

If you are running an application on Windows, Panther uses the value of open_save to change the title of the file type option menu. You specify the option menu's contents through sm_filetypes.

Example

proc open_save()
vars filename

if @widget("@current")->name == "save_button"
{
call sm_jfilebox \
("filename", "c::\\videobiz", "", "Save File", FB_SAVE)
call save_proc(filename)
}
else if @widget("@current")->name == "new_button"
{
call sm_jfilebox \
("filename", "c::\\videobiz", "*.doc" "New File", FB_OPEN)
call open_proc(filename)
}

See Also

sm_filebox, sm_filetypes