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 selection/********************************************************** //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, rather //we want to attach our code into the execution sequence. So we call the original //function first. origOnSelectionChanged(); //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() { //debugger //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 { //debugger var mapFrame = viewerFrame.mapFrame; if(mapFrame.mapInit) { // Remove the timer so this watch function stops executing clearInterval(timer); // Replace the OnSelectionChanged function with our own function. // 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 selection/********************************************************** what might be the problem Please help me thanks -- View this message in context: http://n2.nabble.com/Event-that-captures-mouse-action-tp3939442p4870628.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users