<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->






<div class=Section1>

<div>

<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>I think you do
not point the viewerFrame (or however you named this frame!!! this is the top
of the ajaxviewer).<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div class=MsoNormal align=center style='margin-left:35.4pt;text-align:center'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal style='margin-left:35.4pt'><b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>Von:</span></font></b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> SriRam007
[via OSGeo.org] [mailto:<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=4871694&i=0" target="_top" rel="nofollow">[hidden email]</a>] <br>
<b><span style='font-weight:bold'>Gesendet:</span></b> Donnerstag, 8. April
2010 14:09<br>
<b><span style='font-weight:bold'>An:</span></b> vd<br>
<b><span style='font-weight:bold'>Betreff:</span></b> RE: Event that captures
mouse action</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:
12.0pt;margin-left:35.4pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>hi vd, <br>
<br>
thanks for giving such a useful site <br>
<br>
Just for learning I am trying to show the number of objects selected <br>
Below is my code taken from that site But <b><span style='font-weight:bold'>not
working</span></b><br>
<br>
<br>
<b><span style='font-weight:bold'>Not showing the number of objects selected in
alert box</span></b>&nbsp; <br>
<br>
///////****************************************/Handling viewer
selection/********************************************************** <br>
//Function variable to store the original OnSelectionChanged <br>
var origOnSelectionChanged = null; <br>
<br>
//Our custom selection handler <br>
function MySelectionHandler() <br>
{ <br>
&nbsp; &nbsp; //This is important. We don't want to replace the original
function, rather <br>
&nbsp; &nbsp; //we want to attach our code into the execution sequence. So we
call the original <br>
&nbsp; &nbsp; //function first. <br>
&nbsp; &nbsp; origOnSelectionChanged(); <br>
<br>
&nbsp; &nbsp; //Now our code goes here. For our example, we'll just show the
number of objects selected. <br>
&nbsp; &nbsp; var count = viewerFrame.GetMapFrame().GetSelectedCount(); <br>
&nbsp; &nbsp; alert(count + &quot; features selected&quot;); <br>
} <br>
window.onload = function() <br>
{ <br>
//debugger <br>
&nbsp; &nbsp; //Timer variable <br>
&nbsp; &nbsp; var timer; <br>
<br>
&nbsp; &nbsp; // This is our &quot;watch&quot; function. What we are doing here
is <br>
&nbsp; &nbsp; // repeatedly checking the mapInit value of the Map Frame. When <br>
&nbsp; &nbsp; // mapInit is true, then the map has been loaded. <br>
&nbsp; &nbsp; var watch = function() <br>
&nbsp; &nbsp; { <br>
&nbsp; &nbsp; &nbsp; &nbsp; <br>
&nbsp; &nbsp; &nbsp; &nbsp; // What we are doing here is attempting to access
the mapInit <br>
&nbsp; &nbsp; &nbsp; &nbsp; // variable of the Map frame. The reason the code
is in a try-catch <br>
&nbsp; &nbsp; &nbsp; &nbsp; // is because chances are that this code access the
DOM <br>
&nbsp; &nbsp; &nbsp; &nbsp; // of the map frame before its DOM has been
initialized. <br>
&nbsp; &nbsp; &nbsp; &nbsp; try { <br>
&nbsp; &nbsp; &nbsp; &nbsp; //debugger <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var mapFrame = viewerFrame.mapFrame; <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(mapFrame.mapInit) <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { <br>
&nbsp; <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Remove the timer so
this watch function stops executing <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clearInterval(timer); <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Replace the
OnSelectionChanged function with our own function. <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // It is safe to do
this now because the DOM for the map frame is fully initialized. <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Store old function <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; origOnSelectionChanged
= mapFrame.OnSelectionChanged;////<b><span style='font-weight:bold'>Here not
getting anything &quot;Undefind&quot; showing</span></b><br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Now replace with our
own. <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
mapFrame.OnSelectionChanged = MySelectionHandler; <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <br>
&nbsp; &nbsp; &nbsp; &nbsp; } <br>
&nbsp; &nbsp; &nbsp; &nbsp; catch(e) { <br>
&nbsp; &nbsp; &nbsp; &nbsp; } <br>
&nbsp; &nbsp; }; <br>
&nbsp; &nbsp; <br>
&nbsp; &nbsp; // Start the &quot;watching&quot; process. We basically invoke
the watch function <br>
&nbsp; &nbsp; // every 200ms until the map has been loaded. <br>
&nbsp; &nbsp; timer = setInterval(watch, 200); <br>
}; <br>
///////****************************************/Handling viewer
selection/********************************************************** <br>
<br>
<br>
what might be the problem Please help me <br>
<br>
<br>
<br>
thanks <o:p></o:p></span></font></p>

<div class=MsoNormal align=center style='margin-left:35.4pt;text-align:center'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=1 width="100%" noshade color="#cccccc" align=center>

</span></font></div>

<div>

<p class=MsoNormal style='margin-left:35.4pt'><font size=1 color="#666666"
face=Tahoma><span style='font-size:8.5pt;font-family:Tahoma;color:#666666'>View
message @ <a
href="http://n2.nabble.com/Event-that-captures-mouse-action-tp3939442p4870628.html" target="_top" rel="nofollow" link="external">http://n2.nabble.com/Event-that-captures-mouse-action-tp3939442p4870628.html</a>
<br>
To unsubscribe from RE: Event that captures mouse action, <a target="_top" rel="nofollow" link="external">click
here</a>. <o:p></o:p></span></font></p>

</div>

<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>





<br><hr align="left" width="300">
View this message in context: <a href="http://n2.nabble.com/Event-that-captures-mouse-action-tp3939442p4871694.html">AW: Event that captures mouse action</a><br>
Sent from the <a href="http://n2.nabble.com/MapGuide-Users-f1803227.html">MapGuide Users mailing list archive</a> at Nabble.com.<br>