I am attempting to set up an Identify button that will only allow the identify functionality to be performed when the button is pressed. I have gotten to the point that the identify only works when the button has been pushed the first time but I can't seem to turn the button off. I have pasted a few bits of code below or you can follow the link to see the entire thing.
http://geoville.org/viewers/PopUp/
Funtion to activate Identify
function activateIdentify(){
if (dijit.byId("tool_identify").checked) {
dojo.connect(map, "onClick", executeIdentifyTask);
}
}
Button to Activate function
<div dojoType="dijit.form.ToggleButton" id="tool_identify" iconClass="dijitCheckBoxIcon" onClick="activateIdentify();" >Identify</div>
Function to toggle buttons
function toggleButtonIcon(tool) {
//only the tools in the toolbar are dijit togglebuttons so can iterate thru them
dijit.registry.byClass("dijit.form.ToggleButton").forEach(function(togbtn) {
if (togbtn == tool) {
togbtn.attr("checked", true);
}
else {
togbtn.attr("checked", false);
}
});
} //end toggleButtonIcon
Thanks for your help.
-Mike