Directions dijit at 3.12 ActivateButton

4114
2
12-30-2014 09:31 AM
DavidColey
Frequent Contributor

Hi, can anyone tell me what the ActivateButton is aliased as?  I'm referring to the same tool contained in the measurement dijit, where I disable my info window on click when one of the three measurement tools are active.

Please forgive the lack of formatting here, I'm having to post this question from my cell phone.

Thanks

David

0 Kudos
2 Replies
KellyHutchins
Esri Frequent Contributor

David,

Here's some code that should work - however its accessing a private property (_activateButton) and we don't typically recommend that people rely on undocumented properties.  We'll work on adding a public documented way to do this for 3.13 so if you add this to your code make a note to revisit it once 3.13 is live.

       on(directions._activateButton, "click", function(){
          if(directions.active){
            //deactivate info windows. 
          }
        });
DavidColey
Frequent Contributor

Hi Kelly, sorry for the delayed response (my workplace has geonet access issues).  Yes the sample you provided will work, but not quite in the way I require, but it got me on the right track thanks very much.  Here's what I did:

At startup, the default state is active where the activateButton is listening for mouse clicks, so I deactivate it:

directions.on("load", function(){
  directions.deactivate();
  });

Then, in order to disable the infoWindow I use a function that is hitched to the directions div on my index page:

function disablePopup() {
     if(directions.active){
          mapMain.setInfoWindowOnClick(false);
     }
     else{
          mapMain.setInfoWindowOnClick(true);
     }
}
//pass it to the index page
lang.setObject("disablePopup", disablePopup);

<div id="dirPane" data-dojo-type="dijit/layout/AccordionPane" data-dojo-props="title: 'Route By Address', selected:false" onclick="disablePopup();">

where we control the popups based on the base widgets' active state when the div becomes active, which is essentially how I am handling the measure and draw tools as well when I need to prevent the infoWindow.

For whatever reason I couldn't see same logic pattern here . . thanks again!

0 Kudos