[mapguide-users] AW: Event that captures mouse action

vd vd at plan-online.info
Thu Apr 8 11:08:56 EDT 2010

I think you do not point the viewerFrame (or however you named this frame!!!
this is the top of the ajaxviewer).



Von: SriRam007 [via OSGeo.org]
[mailto:ml-node+4870628-1747384781-272960 at n2.nabble.com] 
Gesendet: Donnerstag, 8. April 2010 14:09
An: vd
Betreff: RE: Event that captures mouse action


hi vd, 

thanks for giving such a useful site 

Just for learning I am trying to show the number of objects selected 
Below is my code taken from that site But not working

Not showing the number of objects selected in alert box  

///////****************************************/Handling viewer
//Function variable to store the original OnSelectionChanged 
var origOnSelectionChanged = null; 

//Our custom selection handler 
function MySelectionHandler() 
    //This is important. We don't want to replace the original function,
    //we want to attach our code into the execution sequence. So we call the
    //function first. 

    //Now our code goes here. For our example, we'll just show the number of
objects selected. 
    var count = viewerFrame.GetMapFrame().GetSelectedCount(); 
    alert(count + " features selected"); 
window.onload = function() 
    //Timer variable 
    var timer; 

    // This is our "watch" function. What we are doing here is 
    // repeatedly checking the mapInit value of the Map Frame. When 
    // mapInit is true, then the map has been loaded. 
    var watch = function() 
        // What we are doing here is attempting to access the mapInit 
        // variable of the Map frame. The reason the code is in a try-catch 
        // is because chances are that this code access the DOM 
        // of the map frame before its DOM has been initialized. 
        try { 
            var mapFrame = viewerFrame.mapFrame; 
                // Remove the timer so this watch function stops executing 
                // Replace the OnSelectionChanged function with our own
                // It is safe to do this now because the DOM for the map
frame is fully initialized. 
                // Store old function 
                origOnSelectionChanged =
mapFrame.OnSelectionChanged;////Here not getting anything "Undefind" showing
                // Now replace with our own. 
                mapFrame.OnSelectionChanged = MySelectionHandler; 
        catch(e) { 
    // Start the "watching" process. We basically invoke the watch function 
    // every 200ms until the map has been loaded. 
    timer = setInterval(watch, 200); 
///////****************************************/Handling viewer

what might be the problem Please help me 



View message @

To unsubscribe from RE: Event that captures mouse action, click
< (link removed) 
uaW5mb3w0ODcwMTQ2fDEzOTkxODM0ODk=>  here. 


View this message in context: http://n2.nabble.com/Event-that-captures-mouse-action-tp3939442p4871694.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20100408/7b99934b/attachment.html

More information about the mapguide-users mailing list