set_active_layer

 

Description

add to TreeNode the name of the active graph page and the active layer number


set the given layer to be active layer, if page not open, will open it to be active page as well

Syntax

bool set_active_layer( TreeNode & trNode )

bool set_active_layer( Layer & layr )

Parameters

trNode
[output] tree node to add the needed info

layr
[input] typically a GraphLayer to be set as active

Return

TRUE if the active layer is a graphic layer, FALSE if no active graph layer available


true if successful

Examples

EX1

//This example show the info. of the curve.
//For this sample to work, active layer should exist and is graphLayer.
void set_active_layer_ex1()
{
    GraphLayer gl = Project.ActiveLayer();
    if(gl)
    {
        Tree trNode;
        bool bOK = set_active_layer(trNode);
        if(bOK)
        {
            out_tree(trNode);
        }
    }
}


EX2

void set_active_layer_ex2()
{
    GraphPage  gp;
    gp.Create();
    printf("Active layer is :%s\n", Project.ActiveLayer().GetName());
    
    WorksheetPage wksPage;
    wksPage.Create("Origin");
    printf("Active layer is :%s\n", Project.ActiveLayer().GetName());
    
    GraphLayer gl = gp.Layers(0);
    set_active_layer(gl);    
    printf("Active layer is :%s\n", Project.ActiveLayer().GetName());
}

Remark

See Also

get_graph_layer

header to Include

origin.h

Reference