Select to view content in your preferred language

Hide Info Window When Using Measurement Dijit and Feature Layers

1840
9
07-29-2014 03:25 PM
DavidColey
Honored Contributor

Hi-

Does anyone have any suggestions on how to hide the infoWindow when using the Measurement Dijit when your map contains feature layers?  For example, after calling measurement.startup, you should be able to invoke the hide method for the infoWindow thusly

var measurement = new Measurement({

          map: mapMain,

          defaultAreaUnit: Units.SQUARE_MILES,

          defaultLengthUnit: Units.MILES,

          }, dom.byId("measurementDiv"));

          measurement.startup();

          mapMain.infoWindow.hide();

I am certain I am missing something, but just can't find it.  The problem is that if a feature layer is visible, I'm just not able to hide the info window when making a measurement (i.e I just can't get the syntax correct).  All suggestions are welcome-

Thanks-

David

0 Kudos
9 Replies
RobertScheitlin__GISP
MVP Emeritus

David,

   Have you seen this thread with a possible workaround?

https://community.esri.com/message/391795#391795

0 Kudos
DavidColey
Honored Contributor

Thanks Robert-

I hadn't worked with aspect yet, thanks for the heads up-

David

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

David,

   If this helps then be sure to mark the reply as helpful. To do this you just click on the actions menu link at the bottom left of a reply and choose "Mark as Helpful". If a reply answers your question than be sure to click on the "Correct Answer" link in that reply.

LuciHawkins
Frequent Contributor

Hi David,

I check to see if there is an active button on the measurement toolbar before my "Identify" is performed by using the following:

function runIdentifies(evt) {

var measureMode = dojo.query(".esriButton .dijitButtonNode").some(function(node, index, arr) {

if (node.childNodes[0].checked) {

//at least one of the measure tools is active so disable identify

return true;

}

});

if (!measureMode) {

  ....the rest of my runIdentifies is here

I apologize for it not being formatted, but the "advanced editor" is not available for some reason:-/

Thanks,

Luci

DavidColey
Honored Contributor

Thanks Luci- not a problem.  Not sure if what you have here will work for me on the dijit since it looks like what you are works with a task, but I'm going to give it a try and let you know.  I know I can certainly use it on an interactive route task I have set up, where my work-around is to use a mouse-down as opposed to a click event when adding a stop or barrier graphic on my map, where mouse-down is a bit weird on touch screens

Thanks-

David

0 Kudos
DavidColey
Honored Contributor

Hi All-

We engineered another solution.  As we are using an accordian container we simply provided an argument for the accordion div's onClick Event:

<div id="accordion" data-dojo-type="dijit/layout/AccordionContainer" onclick="listenForSelectedChild();">

And then passed in the function from the js file:

function listenForSelectedChild(){

        if(dijit.byId('accordion').selectedChildWidget.id == "findPane"){

            mapMain.setInfoWindowOnClick(false);

        }

        else {

            mapMain.setInfoWindowOnClick(true);

        }

     }

     lang.setObject("listenForSelectedChild", listenForSelectedChild);

where setting the object makes the function globally avaibable to the html.  In this way, whenever the selected acordion pane has the focus, the popup is disabled.  Should work with any controls as well.  Perhaps not as elegant as the solution in the thread Robert referred me to, but I was having trouble the dojo/aspect api.

Apologies on the non-formatting, as above for Luci the 'advanced editor' doesn't seem to be available...

Thanks

David

RobertScheitlin__GISP
MVP Emeritus

David and Luci,

   The advanced editor is not available when you are replying for your inbox you have to go to the actual thread to get to the advanced editor.

DavidColey
Honored Contributor

Oh, thanks for the info Robert!

0 Kudos
DavidColey
Honored Contributor

Hi all-

I actually have an update that disables the popup when one of the measurment tools is selected as opposed to the entire accordion pane in the html:

function disablePopup() {

  if (measurement.activeTool == "area" || measurement.activeTool == "distance" || measurement.activeTool == "location"){

  mapMain.setInfoWindowOnClick(false);

  }

  else{

       mapMain.setInfoWindowOnClick(true);

       }

  }

  lang.setObject("disablePopup", disablePopup);

the onClick call must still be set on the div pane that contains the measurement dom node.  Perhaps a bit more elegant than my earlier solution of disabling popups when the entire pane has the focus, although there are certainly cases where that would be useful as well...

Enjoy

David