Project::ActiveLayer

Description

It returns the active Layer object. The active Layer object corresponds to the active layer in the active window (graph, worksheet, matrix, or layout).

Syntax

Layer ActiveLayer( )

Parameters

Return

The active Layer object.

Examples

EX1

//with a new project, try new wks, new graph, new matrix, new layout and a new notes window
//when notes window is active, the ActiveLayer is not changed, so you should see the last active 
//layer when a notes window is active
void Project_ActiveLayer_ex1()
{
    Layer lay = Project.ActiveLayer();
    
    if(!lay)
    {
        out_str("the project is empty");
        return;
    }
    
    Worksheet wks = lay;// try casting into a worksheet
    if(wks)
    {
        printf("Active sheet has %d columns and %d rows\n", wks.GetNumCols(), wks.GetNumRows()); 
        return;
    }
    // if not a worksheet, try a graph
    GraphLayer glay = lay;
    if(glay)
    {
        printf("Active graph as %d data plots\n", glay.DataPlots.Count());
        return;
    }
    out_str("Active layer might be a matrix or a layout page");
}

Remark

See Also

Project::ActiveCurveBase, Project::ActiveCurve, Project::ActiveFolder

header to Include

origin.h