onSelectionChanged   Go to object model Go to parent topic Go to previous topic Go to next topic

Syntax

onSelectionChanged map

Description

This event is fired when the map selection has changed.

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

Applies To

ActiveX Control only

Parameters

map - The map object for which the event occurred.

Error Codes

none

Note

If your application has notify (the second argument of addObject) set to True, writing code in the onSelectionChanged event that changes the selection will result in an infinite loop. For example:

var mapSel = map.getSelection(); 
var obj = layer.getMapObject('CA'); 
mapSel.addObject(obj, true); 

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_onSelectionChanged(map)
onSelectionChanged map
End Sub
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
function onSelectionChanged(map)
{
// 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

getSelectionChangedObserver, setSelectionChangedObserver