Open a pop-up window with a file browser.

Syntax
int Fct_Save_FileName(
char *title,
char *format_dscr,
char *def_name,
char *def_ext,
char file[]
) ;
Parameters
title
A text string that will be displayed at the top of the window.
format_dscr
A buffer containing pairs of null-terminated filter strings. The last string in the buffer must be terminated by two NULL characters.
The first string in each pair is a display string that describes the filter (for example, "Text Files"), and the second string specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string.
The system does not change the order of the filters. It displays them in the File Types combo box in the order specified in format_dscr.
If format_dscr is NULL, the dialog box does not display any filters.
def_name
Default file name.
def_ext
Default file extension.
file
Pointer to a string that will be filled with the selected file's name and path.
Return value
This function open a dialogue box using the "GetSaveFileName" mechanism.
Remarks
Requirements
Header:
sliceO_include.hpp
Library:
sliceO_Structures.lib
Example
|
...
if ( but_save.Select( up_down ) ) {
but_save.Cur_Value = 1 ;
but_save.Adjust() ;
// --- get the file's name ---
if ( list_geom.Cur_Value >= 0 ) {
char file[MAX_PATH] ;
static char szFilter[] = "Movie BYU (*.mov)\0*.mov\0"
"Autocad DXF (*.dxf)\0*.dxf\0"
"VRML (*.wrl)\0*.wrl\0"
"STL ASCII (*.stl)\0*.stl\0"
"STL BINARY (*.stl)\0*.stl\0"
"\0" ;
int ret = Fct_Save_FileName( "Save Geom File", szFilter, list_geom.Item[list_geom.Cur_Value]->Name, "mov", file ) ;
if ( ret ) {
char *format = "---" ;
char ext[10] ;
Get_Generic_Name( file, NULL, NULL, ext ) ;
switch (ret) {
case 1 :
format = "mov" ;
// --- if no user's extension, give one ---
if ( ! *ext )
strcat( file, ".mov" ) ;
break ;
case 2 :
format = "dxf" ;
// --- if no user's extension, give one ---
if ( ! *ext )
strcat( file, ".dxf" ) ;
break ;
case 3 :
format = "wrl" ;
// --- if no user's extension, give one ---
if ( ! *ext )
strcat( file, ".wrl" ) ;
break ;
case 4 :
format = "stl_ascii" ;
// --- if no user's extension, give one ---
if ( ! *ext )
strcat( file, ".stl" ) ;
break ;
case 5 :
format = "stl" ;
// --- if no user's extension, give one ---
if ( ! *ext )
strcat( file, ".stl" ) ;
break ;
}
// --- the actual "saving" is done through a script command ---
Script_Read_Line( "geom: \"%s\" write %s \"%s\"\n", list_geom.Item[list_geom.Cur_Value]->Name, format, file ) ;
}
}
but_save.Cur_Value = 0 ;
but_save.Adjust() ;
}
...
|
|
See also