| onViewChanging |
|
onViewChanging map
This event is fired just before the map is refreshed.
This topic describes this event for ActiveX Control. For Plug-In and Java Edition, see MGViewChangingObserver.onViewChanging.
There are many useful actions you can execute with onViewChanging, for instance, customizing layer settings such as visibility, the SQL Where clause, or the data file to which a layer refers. If you just want to initialize layer settings the first time that Autodesk MapGuide Viewer displays a map, as opposed to every time that the map is refreshed, use the onMapLoaded event instead.
Note that Autodesk MapGuide disables the autoRefresh flag, set by setAutoRefresh, when it executes the onViewChanging event. Therefore, calling zoomGotoDlg, zoomGotoLocation, setUrl, or refresh in onViewChanging has no effect. Additionally, setAutoRefresh has no effect when called from within onViewChanging.
ActiveX Control only
map - The map object for which the event occurred.
none
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_onViewChanging(map)
onViewChanging map
End Sub
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function onViewChanging(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.
getViewChangingObserver, setViewChangingObserver