[mapguide-users] Newbie needs help with project to query web

Nick Aizen naizen at gcrconsulting.com
Fri May 2 15:45:41 EDT 2008


Thanks, this is a big help, my question is about the java script code:

<!-- Javascript part -->
<script type="text/javascript">
    var mapFrame = null;   // A reference to the map frame
    var originalMapFrameOnSelectionChanged = null // storage for the
original onSelectionChanged function
    function OnSelectionChanged() // when something is selected on the map
    {
        alert('Your handler works perfectly');
        originalMapFrameOnSelectionChanged();
    }

    function InitDocument()
    {
        var win = document.getElementById('viewerFrame');
        if (win.contentWindow) //FF returns the actual tag, IE returns
the iframe
          win = win.contentWindow;
        mapFrameRef = win.GetMapFrame();
        originalMapFrameOnSelectionChanged =
mapFrameRef.parent.OnSelectionChanged;
        mapFrameRef.parent.OnSelectionChanged =
OnSelectionChanged;
    }

    function RetryInit()
    {
        if (mapFrame != null)
            return;

        try
        {
            InitDocument();
            //At this point, you can post a "PageLoaded" via a form or AJAX
        }
        catch (e)
        {
            mapFrame = null;
        }

        if (originalMapFrameOnSelectionChanged == null)
        {
            mapFrame = null;
            window.setTimeout("RetryInit();", 500);
        }
</script>


What does it actually do? I know this is not a java script tutoral, was wondering how this intergrates with mapGuide. Could I just call a C# function so I may use the MG API to manipulate the map?


Regards,


Nick Aizen


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080502/9451da93/attachment.html


More information about the mapguide-users mailing list