Setting Up Event Handlers
|
75
ActiveX Control Event Handlers
You can handle events from the Autodesk MapGuide Viewer ActiveX Control
within Microsoft Internet Explorer by defining VBScript functions.
Define VBScript functions in the HTML file where the
<OBJECT>
tag resides.
Define a function for each of the events that you want to handle. Function
names must begin with the name of the
MGMap
object, followed by an under-
score (
_
), followed by the event name and parameter list. For example:
<SCRIPT LANGUAGE="VBScript">
Sub map_onSelectionChanged(map)
onSelectionChanged map
End Sub
</SCRIPT>
When an event occurs, Internet Explorer looks for a VBScript function with
the name of the object in which the event occurred followed by the event.
For example, in response to an
onSelectionChanged
event, Internet
Explorer looks for a function named
mapName
_
onSelectionChanged
. If it
finds such a function, it treats it as the event handler.
Plug-In and ActiveX Control Event Handlers
The following examples support event handling for both Netscape Navigator
and Internet Explorer.
VBScript Example
This VBScript example is designed to handle the
onDigitizedPoint
event
for both Netscape Navigator and Internet Explorer:
// Internet Explorer Observer
<SCRIPT LANGUAGE="VBScript">
//send onDigitizedPoint events from the
// Autodesk MapGuide Viewer ActiveX Control to the
//event-handling function
Sub map_onDigitizedPoint(Map, Point)
onDigitizedPoint Map, Point
End Sub
</SCRIPT>
// Netscape Navigator Observer Applet: MapGuideObserver6.class
// ...if Netscape, embed event observer
if (navigator.appName == "Navigator")
{
document.write("<APPLET CODE=\"MapGuideObserver6.class\"
WIDTH=2 HEIGHT=2 NAME=\"obs\" MAYSCRIPT>");
document.write("</APPLET>");
}
Содержание 15606-011408-9300 - MAP R6.3 UPG
Страница 1: ...15306 010000 5060 October 2001 Autodesk MapGuide Release 6 Developer s Guide ...
Страница 6: ...vi ...
Страница 16: ...16 ...
Страница 30: ...30 ...
Страница 84: ...84 ...
Страница 134: ...134 ...
Страница 202: ...202 ...