2.2.4.13 Folder


Contents

Name

Folder

Remark

Project Explorer is a Windows Explorer like user interface inside Origin. It contains a folder/sub-folder structure used to organize and facilitate access to the graph, layout, matrix, note, and worksheet windows of an Origin project file.

The Folder class is used to access the methods and properties of Project Explorer and contains collections of all Origin pages and Project Explorer folders.

An Origin C Folder object is a wrapper object that is a reference to an internal Origin project explorer object. Origin C wrapper objects do not actually exist in Origin and merely refer to the internal Origin object. Consequently, multiple Origin C wrapper objects can refer to the same internal Origin object.

Hierarchy

Examples

EX1

// List all page names in all first level subfolders of root folder
void    Folder_Folder_Ex1()
{
    Folder fld, fldSub;
    fld = Project.RootFolder;
    PageBase pb;

    foreach(fldSub in fld.Subfolders)
    {
        // Display the names of the subfolders of root
        printf( "Folder name = %s\n", fldSub.GetName() );
        foreach(pb in fldSub.Pages)
        {
            // Display the name of the page:
            printf( "\tPage name = %s\n", pb.GetName() );
        }
    }
}

EX2

// List all folders and windows in a heirachical structure with window details
// Note the additional support functions:
//        Folder_DisplayFolderAndPages
//        Folder_DisplayInfo
//        Folder_InfoDump
// variable (iLevel) and define (repeattab)
void    Folder_Folder_Ex2()
{
    Folder        fld = Project.RootFolder;
    printf( "%s\\\n", fld.GetName() );
    Folder_DisplayFolderAndPages(fld);
}
// This variable handles the indent level for printout
static    int    iLevel = 0;
// Macro that prints indent for each level - a sequence of four spaces here
#define    repeattab    for( int ii = 1 ; ii <= iLevel ; ii++) printf("    ");
// Function that is called recursively to walk the folder tree structure
void    Folder_DisplayFolderAndPages(Folder    fld)
{
    Folder        fldSub;
    PageBase    pb;
    iLevel++;
    foreach(pb in fld.Pages)
    {
        // Display the name of the page:
        repeattab;
        printf( "%s", pb.GetName() );
        Folder_DisplayInfo(pb);
    }
    foreach(fldSub in fld.Subfolders)
    {
        // Display the name of the current subfolder
        repeattab;
        printf( "%s\\\n", fldSub.GetName() );
        Folder_DisplayFolderAndPages(fldSub); // and recursively call
    }
    iLevel--;
}
// Display the window type
void    Folder_DisplayInfo(PageBase    pb)
{
    switch( pb.GetType() )
    {
    case 2:
        printf(" - Worksheet ");
        Folder_InfoDump(pb);
        break;
    case 3:
        printf(" - Graph ");
        Folder_InfoDump(pb);
        break;
    case 5:
        printf(" - Matrix ");
        Folder_InfoDump(pb);
        break;
    case 9:
        printf(" - Notes ");
        Folder_InfoDump(pb);
        break;
    case 11:
        printf(" - Layout ");
        Folder_InfoDump(pb);
        break;
    case 12:
        printf(" - Excel ");
        Folder_InfoDump(pb);
        break;
    default:
        printf(" - Unknown Type\n");
    }
}
// Display information about the window
void    Folder_InfoDump(PageBase    pb)
{
    PageSystemInfo    info; // Structure to receive page info
    bool    bVal = pb.GetPageSystemInfo(&info);
    if(pb.GetShow()) printf("(Hidden)"); else printf("(Visible)");
    printf(", Created %s", get_date_str(info.dCreated, LDF_YYMMDD_AND_HHMMSS_SEPARCOLON));
    printf(", Modified %s", get_date_str(info.dModified, LDF_YYMMDD_AND_HHMMSS_SEPARCOLON));
    printf(", Size %u", info.nSize);
    if( pb.GetType() != 9 && pb.GetType() != 11 ) printf(", %u Dependents", info.nDependents);
    printf("\n");
}

Header to Include

origin.h

Reference

Members

Name Brief Example
Make a folder the active folder
Create a Subfolder and Add it to given folderPath.
Adds a shortcut to the given page to the Folder
Create a subfolder by name
Attach or re-attach an existing folder object to a named instance
Default folder constructor
Get the comments of specified folder
Return a folder object from its name
Get property info of folder,such as size,type,location .etc.
Get index of calling folder object
Get page index in folder.
Get the name of a folder
Get the parent folder of a folder object
Return full path of active folder as string
Finds out if the Folder contains a shortcut to the given page
Check if the folder object is the root folder.
Check if the folder object is valid
Move a folder or window
Get a page object from the Pages collection
Get a page object from the Pages and Shortcts collection
Remove the shortcut to the given page in the folder
Delete a subfolder by name
Rename a folder
Save a folder as an Origin project file
set comments to folder

Property

Name Brief Example
Access Pages as a collection
Access Pages and Page shortcuts as a collection
Access subfolders as a collection