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

Syntax

onMapLoaded map

Description

This event is fired when Autodesk MapGuide loads an MWF into the Autodesk MapGuide Viewer, before the first refresh.

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

A typical use of onMapLoaded is to set certain MWF properties, such as a SQL where clause, based on external variables, for example, the user name. If you want to change settings every time the map is about to be refreshed, use the onViewChanging event instead.

Note that Autodesk MapGuide disables the autoRefresh flag, set by setAutoRefresh, when it executes the onMapLoaded event. Therefore, calling zoomGotoDlg, zoomGotoLocation, setUrl, or refresh in onMapLoaded has no effect. Additionally, setAutoRefresh has no effect when called from onMapLoaded.

Applies To

ActiveX Control only

Parameters

map - The MGMap map object that this event applies to.

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_onMapLoaded(map)
onMapLoaded map
End Sub
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
function onMapLoaded(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.