2.2.4.33.7 Page::GetSelectedLayers

Description

To get layer/sheets selection

Syntax

int GetSelectedLayers( vector<int> & vnIndices, vector<string> & vsNames = NULL )

Parameters

vnIndices
[output] indices of selected layers/sheets, 0-offset
vsNames
[output] names of these selected layers/sheets

Return

< 0 for errors but otherwise return the number of selected layers

Examples

EX1

// to get the name of selected layers
int Page_GetSelectedLayers_Ex1()
{
    WorksheetPage wp = Project.Pages();
    if( !wp )
        return -1;
    
    vector<string> vsNames;
    int nn = wp.GetSelectedLayers(NULL, vsNames);
    for(int ii = 0; ii < vsNames.GetSize(); ii++)
        out_str(vsNames[ii]);
    return 0;
}

EX2

// to get the index of selected layers
int Page_GetSelectedLayers_Ex2()
{
    WorksheetPage wp = Project.Pages();
    if( !wp )
        return -1;
 
    vector<int> vns;
    int nn = wp.GetSelectedLayers(vns);
    for(int ii = 0; ii < vns.GetSize(); ii++)
        printf("The index is : %d\n", vns[ii]);
    return 0;
}

Remark

See Also

Header to Include

origin.h