Autodesk 15606-011408-9300 Developer Guide - Page 78
VBScript and JavaScript Example, Writing Event Handlers
UPC - 606121429548
View all Autodesk 15606-011408-9300 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 78 highlights
VBScript and JavaScript Example The following VBScript and JavaScript example shows an HTML page that handles the onSelectionChanged event for both Netscape and Microsoft browsers. This example forwards the event from your VBScript function to a shared JavaScript function that processes the event. For example, the following function handles the onSelectionChanged event for an MGMap object called map: // This VBScript function handles events from the // Autodesk MapGuide Viewer ActiveX Control // control and passes it to the JavaScript function defined // below. Netscape browsers will ignore the VBScript methods. Sub map_onSelectionChanged(map) onSelectionChanged map End Sub // The following JavaScript function processes events // for both the Autodesk MapGuide Viewer ActiveX Control and // Autodesk MapGuide Viewer Plug-In. // Autodesk MapGuide Viewer ActiveX Control events // are forwarded to this function via VBScript, and // Autodesk MapGuide Viewer Plug-In events are // forwarded to this function via the // Autodesk MapGuide Viewer Plug-In observer. function onSelectionChanged(map) { alert("Selection Changed"); } Writing Event Handlers To make an Autodesk MapGuide observer work properly, always give your event handler the same name as the event it is handling. When the event is fired, the code in the corresponding observer is executed automatically. This section describes how to write JavaScript and Java event handlers for the onBeginLayout and onEndLayout events. 78 | Chapter 5 Handling Events