Folder
folder-class
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
Property
|