esri.toolbars.Draw throws an exception

603
4
03-01-2011 06:20 PM
JoseSousa
Esri Contributor
Dear ArcGIS API for Javascript Team,

When I activate the drawToolbar.activate(esri.toolbars.Draw.POINT) the application throws an exception stating "Microsoft JScript runtime error: Object doesn't support property or method '__resetClickDuration'". In the minimized code it is on map.__resetClickDuration();

Can you provide me some help on this?

Cheers,
Jose

// Piece of code

                var drawToolbar = new esri.toolbars.Draw(map);
                var selectedTemplate;
                dojo.connect(templatePicker, "onSelectionChange", function()
                                                                  {
                                                                      debugger;
                                                                      if(templatePicker.getSelected())
                                                                      {
                                                                          selectedTemplate = templatePicker.getSelected();
                                                                      }
                                                                     
                                                                      switch (selectedTemplate.featureLayer.geometryType)
                                                                      {
                                                                          case "esriGeometryPoint":
                                                                               drawToolbar.activate(esri.toolbars.Draw.POINT);  //THROWS THE EXCEPTION HERE
                                                                          break;
                                                                          case "esriGeometryPolyline":
                                                                               drawToolbar.activate(esri.toolbars.Draw.POLYLINE);
                                                                          break;
                                                                          case "esriGeometryPolygon":
                                                                               drawToolbar.activate(esri.toolbars.Draw.POLYGON);
                                                                          break;
                                                                      }
                                                                  });
0 Kudos
4 Replies
MarcCalello
New Contributor
Bumping this thread.

I'm experiencing the same error with drawToolbar.activate(esri.toolbars.Draw.EXTENT);
0 Kudos
KellyHutchins
Esri Frequent Contributor
Marc,

Can you provide more details - and perhaps a code snippet- regarding this issue. For example, can you reproduce it with the sample on the JavaScript resource center?
0 Kudos
MarcCalello
New Contributor
Thanks Kelly,

I' tried to pull a snippet out of our application - to demonstrate this error:

function selectFeaturesClick(theSelectionToolbar){
  try {
    theSelectionToolbar.activate(esri.toolbars.Draw.EXTENT);
  }
  catch (e) {
    alert('Exception hit: ' + e);
    throw e;
  }
}


The error I get is:
map.__resetClickDuration is not a function
on http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.2 line 48.
0 Kudos
JoseSousa
Esri Contributor
Hi Marc,

Can you confirm that the map instance you used to initialize the toolbar was in fact the map class? If you set it on the wrong scope the map variable will point to another object instead of the map.

// Make sure the map used on this initialisation is the map class ...
var drawToolbar = new esri.toolbars.Draw(map);

José
0 Kudos