Ets_File_Chooser_Save_Create()
Note: Requires OPNET Development Kit
Abstract
Creates a Save... dialog box and prompts the user for a file name.
Syntax
Ets_File_Chooser_Save_Create (title, options, target_dir, type_list_ptr, save_callback, close_callback, state_ptr)
| Argument | Type | Description |
|---|---|---|
title |
const char * |
dialog box title |
options |
int |
Options for file chooser (see Details) |
target_dir |
const char * |
path to the initial directory to display |
type_list_ptr |
PrgT_List * |
the Prg list of strings of the form <type name> (extension1; extension2; …). For example, Network (.nt.m) or Text File (.txt; *.gdf; *.ets). |
save_callback |
EtsT_File_Chooser_Ok_Proc |
process called when the user clicks on the “Save” button in the dialog box (see EtsT_File_Chooser_Ok_Proc for the callback prototype) |
close_callback |
EtsT_File_Chooser_Close_Proc |
process called when user clicks “Cancel” or the save is successful (see EtsT_File_Chooser_Close_Proc for the callback prototype) |
state_ptr |
void * |
User-defined data that is passed to save_callback and close_callback each time they are called. |
Return Type
EtsT_Compcode
EtsC_Compcode_Success if the file chooser Save dialog box is created; EtsC_Compcode_Failure otherwise.
Header
ets_api_gui.h
Details
options must be ETSC_FILE_CHOOSER_OPT_NONE or an OR’ed combination of the following symbolic constants:
ETSC_FILE_CHOOSER_OPT_DIR—specifies that directories (instead of file names) will be displayed and selectableETSC_FILE_CHOOSER_OPT_PROMPT_OVERWRITE—specifies that the user will be prompted whether to overwrite the file, if it already exists
The save_callback is called when the user clicks on the Save button in the file chooser. The following information is passed to the callback:
- the path chosen by the user
- the file type string (for example, “Network (*.nt.m)”)
- a state pointer (
state_ptrargument) to theEts_File_Chooser_Save_Create()call
If the save_callback returns 1, the file chooser is closed and the close_callback is called with the cancel_flag set to 0.
If the save_callback returns 0, the file chooser stays up.
If the “Cancel” button is pressed, close_callback is called with the cancel_flag set to 1.
This function is blocking until the file chooser is closed.