MGSelectionChangedObserver.onSelectionChanged   Go to object model Go to parent topic

Syntax

public abstract void onSelectionChanged(MGMap map)

Description

The changed selection observer event method. This event is fired when the map selection has changed.

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

Applies To

Plug-In and Java Edition 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 Plug-In or Java Edition, a Java object that implements the MGSelectionChangedObserver interface must be established with a call to the setSelectionChangedObserver method. The observer Java object should include the following:

<class_definition> implements MGSelectionChangedObserver
{
// ... 
public void onSelectionChanged(MGMap map)
{
// event handling code here...
}
// ...
}

The simplest way to include the observer object in a Web page is to implement it as an applet. See Advanced Examples for a fully functional observer object that supports all of the observer interfaces by forwarding the events back to JavaScript functions that have identical semantics to the ActiveX Control event handlers.

See Also

getSelectionChangedObserver, setSelectionChangedObserver