Deactivate ESRI measurement widget?

9070
11
05-24-2011 04:25 AM
ChrisBuckmaster1
Deactivated User
Hi

I am wondering if there is an easy way to deactivate/disable the measurement widget?

The only way I can see is clicking back onto the icon that was selected but this isn't that obvious for users so I would like to include a button to disable it (if identify / other tools are then activated).

There is a destroy method but I cannot seem to activate the tool after this, any ideas?
0 Kudos
11 Replies
Quynh_NhuMai
Occasional Contributor

This works very well to deactivate the measure tool--I am trying to use it to deactivate the measure tool when an identify button is toggled. However, I'm getting some conflict with the identify handler I'm using. The code below starts and pauses the identify handler when the identify button is toggled (identify does not work and console prints out "Identify started" followed by "Identify paused". Can anyone see why this may be happening with the code posted below?

var idButton = new ToggleButton({
label: "Identifier les entités",
showLabel: false,
iconClass: "identifyIcon",
checked: false,
onChange: function (val) {
    if (val) {
        window.idHandler = on.pausable(window.myMap, "click", runIdentifies); //runIdentifies is the identify function
        console.log("Identify started");
        measurementActiveButton = dojo.query(".esriMeasurement .esriButton.esriButtonChecked .dijitButtonNode")[0]
        if(measurementActiveButton){
            measurementActiveButton.click();
        }
    }
    else {
        window.idHandler.pause();
        console.log("Identify paused");
    }
}
}, "id_button");
idButton.startup();

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Quynh,

   The way you have your code written the on event handler is added each time toggle is clicked on which results in multiple handlers being added. You need to have you code check for the existence of the window.idHandler and if it exists then do not recreate it.

0 Kudos