Programming Guide



sm_filebox

Opens a file selection dialog box

void int sm_filebox(char *buffer, int length, char *path, char *file_mask, char *title, int open_save);

buffer
On return, contains the selected file's name. Make sure that buffer is at least the size specified by length.

length
The length of buffer.

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.

Environment

C only

Returns

Description

sm_filebox 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 buffer 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

#include <smdefs.h>

#define LEN 256
char buf [LEN];

sm_filebox(buf, LEN, "c::\\videobiz", "*.tbl", "", FB_OPEN);

See Also

sm_filetypes, sm_jfilebox