GetMultiOpenBox
Description
Open an FDLog Open dialog box passing the file types to list in an array of strings. Optionally uses a simple Open dialog with multiple selection enabled or a Multi-Open dialog box.
An easier to use version of GetMultiOpenBox that works for a single file type. Optionally uses a simple Open dialog with multiple selection enabled or a Multi-Open dialog box.
Syntax
int GetMultiOpenBox( StringArray & saFilePaths, StringArray & saFiletypes, LPCSTR lpcszPath = NULL, LPCSTR lpcszFilename = NULL, LPCSTR lpcszDialogName = NULL, bool bMultiSelection = true )
int GetMultiOpenBox( StringArray & saFilePaths, FDLogUseGroup nFDLogUseGroup, LPCSTR lpcszPath = NULL, LPCSTR lpcszFilename = NULL, LPCSTR lpcszDialogName = NULL, bool bMultiSelection = true )
int GetMultiOpenBox( StringArray & saFilePaths, LPCSTR lpcszFileType = NULL, LPCSTR lpcszPath = NULL, LPCSTR lpcszFilename = NULL, LPCSTR lpcszDialogName = NULL, bool bMultiSelection = true )
Parameters
- saFilePaths
- [output] vector of strings containing path and filename of all selected files
- 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"
- bMultiSelection
- [input] flag specifiying to use multi-selection Open (default true) or Multi-Open (false) dialog box
- saFilePaths
- [output] vector of strings containing path and filename of all selected files
- nFDLogUseGroup
- [input] 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"
- bMultiSelection
- [input] flag specifiying to use multi-selection Open (default true) or Multi-Open (false) dialog box
- saFilePaths
- [output] vector of strings containing path and filename of all selected files
- lpcszFileType
- [input] file type string like "*.ext description", "[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"
- bMultiSelection
- [input] flag specifiying to use multi-selection Open (default true) or Multi-Open (false) dialog box
Return
returns the number of files selected.
Returns the path and filename of all selected files or an empty string if Cancel button
in dialog box is clicked. Also returns the number of files selected.
Returns the path and filename of all selected files or an empty string if Cancel button
in dialog box is clicked. Also returns the number of files selected.
Examples
EX1
int GetMultiOpenBox_ex1()
{
int iNumSelFiles;
string strPath;
StringArray saFiletypes, saFilePaths;
saFiletypes.SetSize( 3 );
saFiletypes[0]="[Project (*.OPJ)] *.OPJ";
saFiletypes[1]="[Old version (*.ORG)] *.ORG";
saFiletypes[2]="[Worksheets (*.OGW)] *.OGW";
iNumSelFiles = GetMultiOpenBox( saFilePaths, saFiletypes ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, saFiletypes, "C:\\Program Files\\" ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, saFiletypes, "C:\\Program Files\\", "Origin" ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, saFiletypes, "C:\\Program Files\\", "Origin", "OpenOPJ" ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, saFiletypes, "C:\\Program Files\\", "Origin", "OpenOPJ", true );
if( iNumSelFiles > 0)
{
printf("%d files selected, They are:\n",iNumSelFiles);
for( int ii=0; ii<saFilePaths.GetSize(); ii++)
printf("%s\n",saFilePaths[ii]);
}
else
printf("You did not select any files!");
return 0;
}
EX2
int GetMultiOpenBox_ex2()
{
int iNumSelFiles;
StringArray saFilePaths;
iNumSelFiles = GetMultiOpenBox( saFilePaths, FDLOG_ORIGIN ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, FDLOG_EXCEL, "C:\\Program Files\\" ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, FDLOG_ASCII, "C:\\Program Files\\", "Origin" ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, FDLOG_SCRIPT, "C:\\Program Files\\", "Origin", "OpenOGS" );
//iNumSelFiles = GetMultiOpenBox( saFilePaths, FDLOG_SCRIPT, "C:\\Program Files\\", "Origin", "OpenOGS", false );
if( iNumSelFiles > 0)
{
printf("%d files selected, They are:\n",iNumSelFiles);
for( int ii=0; ii<saFilePaths.GetSize(); ii++)
printf("%s\n",saFilePaths[ii]);
}
else
printf("You did not select any files!");
return 0;
}
EX3
int GetMultiOpenBox_ex3()
{
int iNumSelFiles;
StringArray saFilePaths;
iNumSelFiles = GetMultiOpenBox(saFilePaths); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, "[Old version (*.ORG)] *.ORG" ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, "*.OPJ"); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, "*.ocw Workspace", GetAppPath() + "OriginC\\" ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, "*.ocw Workspace", GetAppPath() + "OriginC\\", "Origin" ); // or
//iNumSelFiles = GetMultiOpenBox( saFilePaths, "*.ocw Workspace", "C:\\Program Files\\", "Origin", "Open Workspace", false );
if( iNumSelFiles > 0)
{
printf("%d files selected, They are:\n",iNumSelFiles);
for( int ii=0; ii<saFilePaths.GetSize(); ii++)
printf("%s\n",saFilePaths[ii]);
}
else
printf("You did not select any files!");
return 0;
}
Remark
See Also
header to Include
origin.h
Reference
|