ActiveLayer Property

Long property. Gets or sets the document's active layer ID (the ID property). The active layer is the layer to which shapes are assigned when dropped on the drawing page.

Applies to: Document object

Syntax

[[Let] layerIDRet =] object.ActiveLayer

[Let] object.ActiveLayer = layerIDSet

The ActiveLayer property syntax has these parts:

Part Description
object Required. An expression that returns a Document object.
layerIDRet Optional. A Long variable.
layerIDSet Required. An expression that returns a Long value. The ID (ID property) of the layer to be set as the active layer of the document.

Remarks

There is always an active layer in the document, because a ConceptDraw document always contains at least one layer. If there is no layer with the ID, specified by layerIDSet in the document, the value of the ActiveLayer property is not modified. Use the LayerByID method to retrieve an instance of the Layer object by the layer ID.

Example

This example contains a document-level script. The script draws two rectangles on the first page of the document. The first rectangle has ID 1, the second rectangle has ID 2.

' Make active the  layer with ID 1
thisDoc.ActiveLayer = 1
' Draw rectangle on the active layer
thisDoc.Page(1).DrawRect(100,100,700,400)

' Make active the  layer with ID 2.
thisDoc.ActiveLayer = 2
' Draw rectangle on the active layer
thisDoc.Page(1).DrawRect(300,300,900,600)

 

See Also

ID property, Layer method, LayerByID method, LayersNum method, Layer object