GetSaveAsBox

 

Description

Open an FDLog SaveAs dialog box passing the file types to list in an array of strings.


An FDLog.UseGroup version of GetSaveAsBox 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 GetSaveAsBox that works for a single file type.

Syntax

string GetSaveAsBox( StringArray & saFiletypes, LPCSTR lpcszPath = NULL, LPCSTR lpcszFilename = NULL, LPCSTR lpcszDialogName = NULL )

string GetSaveAsBox( FDLogUseGroup nFDLogUseGroup, LPCSTR lpcszPath = NULL, LPCSTR lpcszFilename = NULL, LPCSTR lpcszDialogName = NULL )

string GetSaveAsBox( 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 "SaveAs"

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 "SaveAs"

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 "SaveAs"

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 GetSaveAsBox_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 = GetSaveAsBox( saFiletypes ); // or
    //strPath = GetSaveAsBox( saFiletypes, "C:\\Program Files\\" ); // or
    //strPath = GetSaveAsBox( saFiletypes, "C:\\Program Files\\", "Origin" ); // or
    //strPath = GetSaveAsBox( saFiletypes, "C:\\Program Files\\", "Origin", "SaveAsOPJ" );
    if( strPath.IsEmpty() )
        out_str( "User has cancelled the SaveAs dialog box." );
    else
        printf( "The file chosen is %s\n.", strPath );
        return 0;
}


EX2

int GetSaveAsBox_ex2()
{
    string strPath;
    strPath = GetSaveAsBox( FDLOG_ORIGIN ); // or
    //strPath = GetSaveAsBox( FDLOG_EXCEL, "C:\\Program Files\\" ); // or
    //strPath = GetSaveAsBox( FDLOG_ASCII, "C:\\Program Files\\", "Origin" ); // or
    //strPath = GetSaveAsBox( FDLOG_SCRIPT, "C:\\Program Files\\", "Origin", "SaveAsOGS" );
    if( strPath.IsEmpty() )
        out_str( "User has cancelled the SaveAs dialog box." );
    else
        printf( "The file chosen is %s\n.", strPath );
        return 0;
}


EX3

int GetSaveAsBox_ex3()
{
    string strPath;
    strPath = GetSaveAsBox(); // or
    //strPath = GetSaveAsBox( "[Old version (*.ORG)] *.ORG" ); // or
    //strPath = GetSaveAsBox( "*.OPJ"); // or
    //strPath = GetSaveAsBox( "*.ocw Workspace", GetAppPath() + "OriginC\\" ); // or
    //strPath = GetSaveAsBox( "*.ocw Workspace", GetAppPath() + "OriginC\\", "Origin" ); // or
    //strPath = GetSaveAsBox( "*.ocw Workspace", "C:\\Program Files\\", "Origin", "SaveAs Workspace" );
    if( strPath.IsEmpty() )
        out_str( "User has cancelled the SaveAs dialog box." );
    else
        printf( "The file chosen is %s\n.", strPath );
        return 0;
}

Remark

See Also

GetOpenBox

header to Include

origin.h

Reference