Folder
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.
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"); }
origin.h
Name | Brief | Example |
---|---|---|
Activate | Make a folder the active folder | Examples |
AddFolder | Create a Subfolder and Add it to given folderPath. | Examples |
AddShortcut | Adds a shortcut to the given page to the Folder | Examples |
AddSubfolder | Create a subfolder by name | Examples |
Attach | Attach or re-attach an existing folder object to a named instance | Examples |
Folder | Default folder constructor | Examples |
GetComments | Get the comments of specified folder | Examples |
GetFolder | Return a folder object from its name | Examples |
GetFolderInfo | Get property info of folder,such as size,type,location .etc. | Examples |
GetIndex | Get index of calling folder object | Examples |
GetIndexInPageAndShortcuts | Get page index in folder. | Examples |
GetName | Get the name of a folder | Examples |
GetParent | Get the parent folder of a folder object | Examples |
GetPath | Return full path of active folder as string | Examples |
HasShortcut | Finds out if the Folder contains a shortcut to the given page | Examples |
IsRootFolder | Check if the folder object is the root folder. | Examples |
IsValid | Check if the folder object is valid | Examples |
Move | Move a folder or window | Examples |
Pages | Get a page object from the Pages collection | Examples |
PagesAndShortcuts | Get a page object from the Pages and Shortcts collection | Examples |
RemoveShortcut | Remove the shortcut to the given page in the folder | Examples |
RemoveSubFolder | Delete a subfolder by name | Examples |
Rename | Rename a folder | Examples |
SaveAsProject | Save a folder as an Origin project file | Examples |
SetComments | set comments to folder | Examples |
Name | Brief | Example |
---|---|---|
Pages | Access Pages as a collection | Examples |
PagesAndShortcuts | Access Pages and Page shortcuts as a collection | Examples |
Subfolders | Access subfolders as a collection | Examples |