Ets_File_Chooser_Open_Create()
Note: Requires OPNET Development Kit
Abstract
Creates an Open... dialog box and prompts the user to select a file or directory.
Syntax
Ets_File_Chooser_Open_Create (title, options, target_dir, type_list_ptr, open_callback, close_callback, state_ptr)
| Argument | Type | Description |
|---|---|---|
title |
const char * |
dialog box title |
options |
int |
options for file chooser; specifies whether directories or file names will be displayed and selectable (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)”. |
open_callback |
EtsT_File_Chooser_Ok_Proc |
process called when the user clicks on the “Open” 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 open is successful (see EtsT_File_Chooser_Close_Proc for the callback prototype) |
state_ptr |
void * |
User-defined data that is passed to open_callback and close_callback each time they are called. |
Return Type
EtsT_Compcode
EtsC_Compcode_Success if the file chooser Open dialog box is created; EtsC_Compcode_Failure otherwise.
Header
ets_api_gui.h
Details
options must be ETSC_FILE_CHOOSER_OPT_NONE or ETSC_FILE_CHOOSER_OPT_DIR. The latter specifies that directories (instead of file names) will be displayed and selectable
The open_callback is called when the user clicks the Open button in the file chooser. This callback is passed:
- the path chosen by the user
- the file type string (for example, “Network (*.nt.m)”)
- a state pointer (
state_ptrargument) to theEts_File_Chooser_Open_Create()call.
If the open_callback returns 1, the file chooser is closed and the close_callback is called with the cancel_flag set to 0.
If the open_callback returns 0, the file chooser stays up.
If the user clicks on the Cancel button, close_callback is called with the cancel_flag set to 1.
This function is blocking until the file chooser is closed.