Folder::PagesAndShortcuts

 

Description

Access Pages and Page shortcuts as a collection.

Access a collection of pages and shortcuts by index

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

Syntax

Collection<PageBase> PagesAndShortcuts
PageBase PagesAndShortcuts( int nIndex )
PageBase PagesAndShortcuts( LPCSTR lpcszName )

Parameters

nIndex
[input] Zero-based index of the PagesAndShortcuts
lpcszName
[input] String name of page/shutcut to attach to

Return

Returns the PageBase object.

Examples

EX1

// List the Pages and Page shortcuts within the active folder
void    PagesAndShortcuts_Ex1()
{
    string strName;
    Folder fld = Project.ActiveFolder();
    foreach(PageBase page in fld.PagesAndShortcuts)
    {
        strName = page.GetName();
        printf("%s\n", strName );
    }
}

EX2

void    PagesAndShortcuts_Ex2()
{
    Folder    fld = Project.ActiveFolder();
    if(fld.IsValid())
    {
        Page    pg;
        uint    iNumPages,iIndex;
        string    strName;
        iNumPages = fld.PagesAndShortcuts.Count();
        for( iIndex = 0 ; iIndex < iNumPages ; iIndex++)
        {
            pg = fld.PagesAndShortcuts(iIndex);
            if( pg.IsValid() )
            {
                pg.GetName(strName);
                printf("Page is %s\n", strName);
            }
        }
        printf("PageNum is %u\n", iNumPages);
        return;
    }
    printf("there is no active folder in current project");
}

EX3

void    PagesAndShortcuts_Ex3()
{
    Folder    fld = Project.ActiveFolder();
    if(!fld.IsValid())
    {
        printf("there is no active folder in current project");
        return;
    }
    uint iNumPages = fld.PagesAndShortcuts.Count();
    string    strName;
    for( uint iIndex = 0 ; iIndex < iNumPages ; iIndex++)
    {
        Page pg = fld.PagesAndShortcuts(iIndex);
        if( pg.IsValid() )
        {
            pg.GetName(strName);
            Folder    fld = Project.ActiveFolder();
            Page pg = fld.PagesAndShortcuts(strName);
            if( pg )
                if( pg.GetShow() == PAGE_HIDDEN )
                    printf("The page %s is hidden.\n", strName);
                else
                    printf("The page %s is visible.\n", strName);
            else
                printf("Page %s not found in active folder\n", strName);
        }
    }
}

Remark

Get a page object from the Pages/Shortcuts collection by page/shortcut index or name.

See Also

OriginC:Folder::GetIndexInPageAndShortcuts

Header to Included

origin.h