onAddMapLayer   Go to object model Go to parent topic Go to next topic

Syntax

onAddMapLayer URL, layer

Description

This event is fired when a new map layer has been added. It is initiated by a call to addMapLayer.

This topic describes this event for ActiveX Control. For Plug-In and Java Edition, see MGAddMapLayerObserver.onAddMapLayer.

Applies To

ActiveX Control only

Parameters

URL - A string that will contain the URL of the map layer file as passed to the addMapLayer method. This can be used to differentiate between multiple onAddMapLayer events if several layers are added to the map in succession.

layer - An MGMapLayer object for the new map layer. If unsuccessful, this parameter will be null.

Error Codes

none

Example

To handle this event from the Autodesk MapGuide ActiveX Control, define VBScript and JavaScript functions like the following:

<!--
The VBScript function handles the event from the ActiveX Control 
Control and then passes it to the JavaScript function.
-->
<SCRIPT LANGUAGE="VBScript">
Sub ObjectId_onAddMapLayer(URL, layer)
onAddMapLayer URL, layer
End Sub
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
function onAddMapLayer (URL, layer)
{
// event handling code here...
}
</SCRIPT>

Where ObjectId is the ID of the embedded map specified as part of the HTML OBJECT tag. Refer to "Displaying Maps" in the Autodesk MapGuide Developer's Guide for details on how to embed the ActiveX Control using the OBJECT tag.

See Also

addMapLayer