How to Hide Popup/InfoWindow?

3448
2
07-30-2013 10:16 AM
CraigMcDade
Occasional Contributor III
I'm having trouble figuring out the proper way to disable popups when measuring. This issue has been discussed here, here, and here. I've tried the suggested solutions but still can't get the popups to stop while I'm using the measurement widget.

My app is here if that might help get me pointed in the right direction.

Thanks.
0 Kudos
2 Replies
BenFousek
Occasional Contributor III
You can disable/enable mouse events for graphic/feature layers using the enableMouseEvents and disableMouseEvents methods. Here are the functions I call when initiating map click, draw tool activation, etc to prevent graphic selection and popups; and when said events are complete.

The measure widget has the onMeasureEnd event which you could connect to enable mouse events; however there is no onMeasureStart event with which to disable mouse events.

mouseEvents: {
  enable: function () {
    dojo.forEach(app.map.graphicsLayerIds, function (layer) {
      app.map.getLayer(layer).enableMouseEvents()
    })
  },
  disable: function () {
    dojo.forEach(app.map.graphicsLayerIds, function (layer) {
      app.map.getLayer(layer).disableMouseEvents()
    })
  }
}
0 Kudos
by Anonymous User
Not applicable

With the changes in version 3.10 I had to refactor my code to disable popups while the measurement widget is active. Here is my approach:

(1) I have the measurement widget as a property of my app class.  I use aspect to run my function after the measurement widget setTool function is called.


aspect.after(this.measurement,'setTool',lang.hitch(this, this._measurementDeconflict));

(2) In my _measurementDeconflict function I check if any of the measurement tools are active and then disable or enable click events for the info window.

_measurementDeconflict: function(evt){
     var blnActive = this.measurement.area.checked ||
                     this.measurement.distance.checked ||
                     this.measurement.location.checked) ? true:false;
     if (blnActive){
          this.map.setInfoWindowOnClick(true);
     }
     else{
          this.map.setInfoWindowOnClick(false);
     }
}




0 Kudos