2.2.4.13.19 Folder::Pages

Description

Access Pages as a collection.


Access a collection of pages by index.


Get a page object from the Pages collection by page name.

Syntax

Collection<PageBase> Pages


PageBase Pages(int nIndex)


PageBase Pages(LPCSTR lpcszName)

Parameters

index
nIndex = [input] Zero-based index of the Pages collection.


lpcszName
[input] String name of page to attach to.

Return

Returns the PageBase object.

Examples

EX1

// List the folders and pages within the active folder
void    Folder_Pages_ex1()
{
    string strName;
    Folder fld = Project.ActiveFolder();
    foreach(Folder sub in fld.Subfolders) // Subfolders is a collection
    {
        strName = sub.GetName();
        printf("<Folder> %s\n", strName );
    } 
    foreach(PageBase page in fld.Pages) // Pages is another collection
    {
        strName = page.GetName();
        printf("%s\n", strName );
    }
}

EX2

// Access a collection of pages by index
void    Folder_Pages_ex2()
{
    string strName;
    Folder fld = Project.ActiveFolder();
    foreach(Folder sub in fld.Subfolders) // Subfolders is a collection
    {
        strName = sub.GetName();
        printf("<Folder> %s\n", strName );
    } 
    for( int i = 0; i < fld.Pages.Count(); i++ ) 
    {
    	PageBase page = fld.Pages(i); //by index
        strName = page.GetName();
        printf("%s\n", strName );
    }
}

EX3

//Get a page object by page name.
void    Folder_Pages_ex3()
{
	string strName = "Book1";
	Folder fld = Project.ActiveFolder();

	PageBase page = fld.Pages(strName);//by name
	if(page)
		out_str("Book1 exists");
}

Remark

Header to Include

origin.h

See Also

Folder::Subfolders

Reference