2.1.27.11 GetOpenBox
Description
Open an FDLog Open dialog box passing the file types to list in an array
of strings.
An FDLog.UseGroup version of GetOpenBox that uses an enumerated FDLog.UseGroup
code to indicate the set of file types to list. See sys_utils.h or the Origin.ini
file for a list of the enumerated FDLOG.UseGroup codes.
An easier to use version of GetOpenBox that works for a single file type.
Syntax
string GetOpenBox( StringArray & saFiletypes, LPCSTR lpcszPath = NULL, LPCSTR lpcszFilename = NULL, LPCSTR lpcszDialogName = NULL )
string GetOpenBox( FDLogUseGroup nFDLogUseGroup, LPCSTR lpcszPath = NULL, LPCSTR lpcszFilename = NULL, LPCSTR lpcszDialogName = NULL )
string GetOpenBox( LPCSTR lpcszFileType = "*.* All Files", LPCSTR lpcszPath = NULL, LPCSTR lpcszFilename = NULL, LPCSTR lpcszDialogName = NULL )
Parameters
- saFiletypes
- [input]Vector containing file types to list in the dialog box, each element
- of vector must follow syntax of LabTalk FDLog.TypeN$ object property
- lpcszPath
- [input]Initial path when dialog opens, default NULL uses FDLog tracking
- lpcszFilename
- [input]Initial filename when dialog opens, default NULL uses an empty string
- lpcszDialogName
- [input]Title of the dialog box, default NULL uses "Open"
- nFDLogUseGroup
- [input]A LabTalk FDLog.UseGroup code as enumerated in sys_utils.h and in
- the Origin.ini file
- lpcszPath
- [input]Initial path when dialog opens, default NULL uses FDLog tracking
- lpcszFilename
- [input]Initial filename when dialog opens, default NULL uses an empty string
- lpcszDialogName
- [input]Title of the dialog box, default NULL uses "Open"
- lpcszFileType
- [input]"*.ext description", or "[decription (*.ext)] *.ext", or just "*.ext"
- lpcszPath
- [input]Initial path when dialog opens, default NULL uses FDLog tracking
- lpcszFilename
- [input]Initial filename when dialog opens, default NULL uses an empty string
- lpcszDialogName
- [input]Title of the dialog box, default NULL uses "Open"
Return
Returns the path and filename of a selecetd file or an empty string if Cancel button
in dialog box is clicked.
Returns the path and filename of a selected file or an empty string if Cancel button
in dialog box is clicked.
Returns the path and filename of a selecetd file or an empty string if Cancel button
in dialog box is clicked.
Examples
EX1
int GetOpenBox_ex1()
{
string strPath;
StringArray saFiletypes;
saFiletypes.SetSize( 3 );
saFiletypes[0]="[Project (*.OPJ)] *.OPJ";
saFiletypes[1]="[Old version (*.ORG)] *.ORG";
saFiletypes[2]="[Worksheets (*.OGW)] *.OGW";
strPath = GetOpenBox( saFiletypes ); // or
//strPath = GetOpenBox( saFiletypes, "C:\\Program Files\\" ); // or
//strPath = GetOpenBox( saFiletypes, "C:\\Program Files\\", "Origin" ); // or
//strPath = GetOpenBox( saFiletypes, "C:\\Program Files\\", "Origin", "OpenOPJ" );
if( strPath.IsEmpty() )
printf( "User has cancelled the Open dialog box." );
else
printf( "The file chosen is %s\n.", strPath );
return 0;
}
EX2
int GetOpenBox_ex2()
{
string strPath;
strPath = GetOpenBox( FDLOG_ORIGIN ); // or
//strPath = GetOpenBox( FDLOG_EXCEL, "C:\\Program Files\\" ); // or
//strPath = GetOpenBox( FDLOG_ASCII, "C:\\Program Files\\", "Origin" ); // or
//strPath = GetOpenBox( FDLOG_SCRIPT, "C:\\Program Files\\", "Origin", "OpenOGS" );
if( strPath.IsEmpty() )
out_str( "User has cancelled the Open dialog box." );
else
printf( "The file chosen is %s\n.", strPath );
return 0;
}
EX3
int GetOpenBox_ex3()
{
string strPath;
strPath = GetOpenBox(); // or
//strPath = GetOpenBox( "[Old version (*.ORG)] *.ORG" ); // or
//strPath = GetOpenBox( "*.OPJ"); // or
//strPath = GetOpenBox( "*.ocw Workspace", GetAppPath() + "OriginC\\" ); // or
//strPath = GetOpenBox( "*.ocw Workspace", GetAppPath() + "OriginC\\", "Origin" ); // or
//strPath = GetOpenBox( "*.ocw Workspace", "C:\\Program Files\\", "Origin", "Open Workspace" );
if( strPath.IsEmpty() )
out_str( "User has cancelled the Open dialog box." );
else
printf( "The file chosen is %s\n.", strPath );
return 0;
}
Remark
See Also
GetSaveAsBox
Header to Include
origin.h
Reference
|