AnsweredAssumed Answered

Trouble deactivating the drawing toolbar when I close my floating pane

Question asked by schlot on May 31, 2013
Latest reply on Jun 4, 2013 by btfou
I have decided that I don't like the new measurement widget, so I'm going back to basics.  I have a floating pane containing two buttons and a display field.  One button for measuring area and the other for measuring length.

I think I have the geometry service calls sorted out, but when I close my floating pane, which should also deactivate the toolbar I created, I continue to have the tooltips for 'Click to start drawing'.  The lines for 'measureActive = true' are used to keep the identify I have defined elsewhere from firing on my click event until I close the measure pane.

Here are the relevant functions:
//functions for measurement  function closeMeasure () {     console.log ("closeMeasure");     measureActive = false;     dojo.disconnect(measureHandler);     dojo.disconnect(measureAreaHandler);     dojo.disconnect(measureLengthHandler);     measureTb.deactivate();     map.graphics.clear();     identifyHandler = dojo.connect(map, 'onClick' , doIdentify); } function openGeomMeasure () {   measureActive = true;   map.graphics.clear();    measureAreaHandler = dojo.connect(geomService, "onAreasAndLengthsComplete", outputAreaAndLength);    measureLengthHandler =dojo.connect(geomService, "onLengthsComplete", outputLength);    var measureError = dojo.connect(geomService, "onError" , measureErrHandler);     var fp = dijit.byId('floater_GeomMeasure');         if ((fp.style =="visibility: hidden;") || (fp.style="VISIBILITY:hidden;")) {            fp.style.visibility="visible";            fp.show();         }      measureHandler = dojo.connect(measureTb, "onDrawEnd", getAreaAndLength);   } function getAreaAndLength(geometry) {       map.graphics.clear();         var graphic = map.graphics.add(new esri.Graphic(geometry, highlightFillSymbol));         var geoType = geometry.type;        if (geoType == 'polygon') {         //setup the parameters for the areas and lengths operation       var areasAndLengthParams = new esri.tasks.AreasAndLengthsParameters();          areasAndLengthParams.areaUnit = esri.tasks.GeometryService.UNIT_ACRES;       geomService.simplify([geometry], function(simplifiedGeometries) {           areasAndLengthParams.polygons = simplifiedGeometries;           geomService.areasAndLengths(areasAndLengthParams);       });        }else {        var lengthParams = new esri.tasks.LengthsParameters();       lengthParams.lengthUnit = esri.tasks.GeometryService.UNIT_FOOT;        lengthParams.geodesic = true;            geomService.simplify([geometry], function(simplifiedGeometries) {           lengthParams.polylines = simplifiedGeometries;           geomService.lengths(lengthParams);       });          }          } function measureErrHandler (error) {     console.log ("MeasureErrHandler = " + error); } function outputAreaAndLength(result) {   console.log(dojo.toJson(result));   dojo.byId("measureText").innerHTML = "<b>Area: </b> " + result.areas[0].toFixed(2) + " Acres";     // dojo.byId('distanceDetails').innerHTML = distance; } function outputLength (result) {     console.log(dojo.toJson(result));    dojo.byId("measureText").innerHTML = "<b>Length: </b> :" + result.lengths[0].toFixed(2) + " Feet";  } function startAreaMeasure () {     measureActive = true;     measureTb.deactivate();     measureTb.activate(esri.toolbars.Draw.POLYGON);     dojo.byId("measureText").innerHTML = ""; } function startDistanceMeasure () {     measureActive = true;     measureTb.deactivate();     measureTb.activate(esri.toolbars.Draw.POLYLINE);     dojo.byId("measureText").innerHTML = "";      }

Outcomes