Hi Kirk - another way to to what Chris has done above is to set up a click event on a feature layer itself:
<SPAN class="token function">on</SPAN><SPAN class="punctuation token">(</SPAN>yourFeatureLayer<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"click"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>measurement<SPAN class="punctuation token">.</SPAN>activeTool <SPAN class="operator token">==</SPAN> <SPAN class="string token">"area"</SPAN> <SPAN class="operator token">||</SPAN> measurement<SPAN class="punctuation token">.</SPAN>activeTool <SPAN class="operator token">==</SPAN> <SPAN class="string token">"distance"</SPAN> <SPAN class="operator token">||</SPAN> measurement<SPAN class="punctuation token">.</SPAN>activeTool <SPAN class="operator token">==</SPAN> <SPAN class="string token">"location"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> mapMain<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setInfoWindowOnClick</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> mapMain<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setInfoWindowOnClick</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
and use the activeTool property of the measurement widget. I might want to try Chris' method as this way you have to set up an event for each feature layer in your module.
David
Hello Kirk,
This is what I was able to do. It disables highlighting and popups when the 'measure-start' event is fired and then enables them when the 'measure-end' event fires.
<SPAN class="token function">on</SPAN><SPAN class="punctuation token">(</SPAN>measurement<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"measure-start"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> popup<SPAN class="punctuation token">.</SPAN>popupWindow <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN> popup<SPAN class="punctuation token">.</SPAN>highlight <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="token function">on</SPAN><SPAN class="punctuation token">(</SPAN>measurement<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"measure-end"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> popup<SPAN class="punctuation token">.</SPAN>popupWindow <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN> popup<SPAN class="punctuation token">.</SPAN>highlight <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I hope this helps.
Chris
Hi, Thanks for you respnonse.Forgive me, I am not quite following the logic here yet.//global variablevar functionMode ="identify";dojo.connect(map, "onclick", function(evt){ if (functionMode =="identify") { // do identify here } else{ return; }});I would like to be able to identify by default from the start of the application. Then when I use the canned ArcGIS Javascript api Measure widget i would like to disable or hide the popup functionality. Can I use the above code to do this? If so, please explain a little more?I appreciate your helpThanks,
Hi hzhu,Can you give an example of the code? I am new to javascript and am experiencing the same problem as Kirk.Thanks,Luci
//global variable var functionMode ="identify"; dojo.connect(map, "onclick", function(evt){ if (functionMode =="identify") { // do identify here } else{ return; } });
I am trying to disable/deactivate/hide my infowindow when I use the standard arcgis javascript api measure widget and have it show when I am not measuring with the following code: dojo.connect(map, 'onLayersAddResult', function (result) { function disablepopup() { map.infoWindow.hide(); } ///Measurement variable var measurement = new esri.dijit.Measurement({map: map, onClick: disablepopup}, dojo.byId('measurementDiv')); measurement.startup(); <!--DEACTIVATES MEASUREMENT TOOLS AFTER MEASUREMENT--> dojo.connect(measurement, "onMeasureEnd", function(activeTool,geometry){ this.setTool(activeTool, false), map.infoWindow.hide() });Currently, when I double click to finish measuring the info window hides as it I want it to but up until that point it popups up like normal when I start my measurement and while I am measuring. Does anyone have a fix for this?I have already thought and looked into the identify listener and tying the identify to a button but in this particular situation I need it to be disabled only when measuring and do not want the user to have to click an identify button.Thanks,Kirk
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.