# 2.1.14.3.26 page_set_active_layer

## Description

Set one of the layer in the given page to be the active layer

## Syntax

bool page_set_active_layer( Page & pg, int nLayer, bool bActiveLayerOnly = true )

## Parameters

pg
[input] page (Graph or Matrix or Workbook) to set
nLayer
[input] zero offset layer(sheet) index to set as active
bActiveLayerOnly
[input] if true the only active layer in page, otherwise, layer will be active in project.

## Return

TRUE if pg is the active window and nLayer is >=0 and less then the total number of layers in the page

## Examples

EX1

void page_set_active_layer_ex()
{
Worksheet wks=Project.ActiveLayer();
if(page_set_active_layer(wks.GetPage(),wks.GetIndex()+1))
printf("Active layer have been set to layer %s",Project.ActiveLayer().GetName());
}