Hey guys,<div><br></div><div>I am using the Geoext for the first time and was going through the tutorials. On this tutorial, <a href="http://geoext.org/tutorials/control-button-tutorial.html">http://geoext.org/tutorials/control-button-tutorial.html</a>, in the "There can only be one" section, the sample code stating how to use the Toggle button,</div>
<div><br></div><div><div>var length = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, {</div><div> eventListeners: {</div><div> measure: function(evt) {</div><div> alert("The length was " + evt.measure + evt.units);</div>
<div> }</div><div> }</div><div>});</div><div><br></div><div>var area = new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon, {</div><div> eventListeners: {</div><div> measure: function(evt) {</div>
<div> alert("The area was " + evt.measure + evt.units);</div><div> }</div><div> }</div><div>});</div><div><br></div><div>mapPanel.map.addControl(length);</div><div>mapPanel.map.addControl(area);</div>
<div><br></div><div>var toggleGroup = "measure controls";</div><div><br></div><div>var lengthButton = new Ext.Button({</div><div> text: 'Measure Length',</div><div> enableToggle: true,</div><div> toggleGroup: toggleGroup,</div>
<div> handler: function(toggled){</div><div> if (toggled) {</div><div> length.activate();</div><div> } else {</div><div> length.deactivate();</div><div> }</div><div> }</div>
<div>});</div><div><br></div><div>var area = new Ext.Button({</div><div> text: 'Measure Area',</div><div> enableToggle: true,</div><div> toggleGroup: toggleGroup,</div><div> handler: function(toggled){</div>
<div> if (toggled) {</div><div> area.activate();</div><div> } else {</div><div> area.deactivate();</div><div> }</div><div> }</div><div>});</div><div><br></div><div>We are using the variable 'area' and 'length' for the OpenLayers Control as well as Ext Button. If we use it like this in plain Javascript, would it not result in an error, as the variable names are meant to be unique, right??</div>
<div><br></div>-- <br>Thanks & Regards<div>Smaran Harihar</div><br>
</div>