Programming Guide |
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 bylength
.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.
C only
- 1 Success: the user chose OK and Panther copied the filename to
buffer
.
- 0 The user chose Cancel. No text is copied to
buffer
.
- -1 Failure: A malloc error occurred or
buffer
was too small.
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 thepath
-specified directory, and lists files that match the wildcard specification infile_mask
. Users can browse through the directory tree. When the user chooses OK, Panther copies tobuffer
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.
#include <smdefs.h>
#define LEN 256
char buf [LEN];
sm_filebox(buf, LEN, "c::\\videobiz", "*.tbl", "", FB_OPEN);