Deactivate Identify

1087
7
Jump to solution
04-16-2012 07:50 AM
ChrisSergent
Regular Contributor III
When running another task I would like to deactivate the identify task. How do I do this?

Here is a video of what I am trying to do: http://youtu.be/xO9DW7LrMhc

And here is the entire project on DropBox: http://db.tt/kyu59b6a
0 Kudos
1 Solution

Accepted Solutions
PaulBushore
Occasional Contributor
Hello,

Within your init() function you are setting the onclick event of the map to fire the doIdentify().  I disabled that and the operations seemed to function in the way you wished.  However, I did have to click the Identify tool to get it to recognize that it needed to identify items.  I haven't looked in to it much further, but thought I would share.    This might not work for you if you are wanting to set the identify as the primary task.  I will look further tomorrow unless someone else with more experience helps you out first.

Best wishes,

View solution in original post

7 Replies
derekswingley1
Frequent Contributor
Hi Chris,

Disconnect your event listener that runs your identify when the measure button is clicked. I haven't dug into your code but somewhere you probably do:
dojo.connect(map, "onClick", executeIdentify);


dojo.connect returns a handle to the event listener you can use to later disconnect the event like so:
var identifyHandle = dojo.connect(map, "onClick", executeIdentify);

// later, when your measure button is clicked:
dojo.disconnect(identifyHandle);


When the measure widget is deactivated, you can re-connect your identify listener.
0 Kudos
ChrisSergent
Regular Contributor III
Derek,
I uploaded a revised version of the application that includes a connect and disconnect. It still does not disconnect.

There is a variable identifyHandle at the top, a dojo.connect when the map loads and then I created another connect for the identify button and a disconnect for the measure button.

Any thoughts?

Chris

Hi Chris,

Disconnect your event listener that runs your identify when the measure button is clicked. I haven't dug into your code but somewhere you probably do:
dojo.connect(map, "onClick", executeIdentify);


dojo.connect returns a handle to the event listener you can use to later disconnect the event like so:
var identifyHandle = dojo.connect(map, "onClick", executeIdentify);

// later, when your measure button is clicked:
dojo.disconnect(identifyHandle);


When the measure widget is deactivated, you can re-connect your identify listener.
0 Kudos
derekswingley1
Frequent Contributor
Where is the identify listener re-connected? Are you connecting it each time the identify button is clicked?
0 Kudos
StephenLead
Regular Contributor III
I uploaded a revised version of the application that includes a connect and disconnect. It still does not disconnect.

There is a variable identifyHandle at the top, a dojo.connect when the map loads and then I created another connect for the identify button and a disconnect for the measure button.


Chris,

Your code is fairly complicated and it'll take time to trawl through it looking for the right sections. Can you make it a bit easier by highlighting in which files the variables are set?

Cheers,
Steve
0 Kudos
derekswingley1
Frequent Contributor
Chris,

Your code is fairly complicated and it'll take time to trawl through it looking for the right sections. Can you make it a bit easier by highlighting in which files the variables are set?

Cheers,
Steve


I'm pretty sure all the relevant code is in js/reactor.js and in-lined in default.aspx.
0 Kudos
PaulBushore
Occasional Contributor
Hello,

Within your init() function you are setting the onclick event of the map to fire the doIdentify().  I disabled that and the operations seemed to function in the way you wished.  However, I did have to click the Identify tool to get it to recognize that it needed to identify items.  I haven't looked in to it much further, but thought I would share.    This might not work for you if you are wanting to set the identify as the primary task.  I will look further tomorrow unless someone else with more experience helps you out first.

Best wishes,
ChrisSergent
Regular Contributor III
I removed that line of code and it works.

Thanks. 🙂
Hello,

Within your init() function you are setting the onclick event of the map to fire the doIdentify().  I disabled that and the operations seemed to function in the way you wished.  However, I did have to click the Identify tool to get it to recognize that it needed to identify items.  I haven't looked in to it much further, but thought I would share.    This might not work for you if you are wanting to set the identify as the primary task.  I will look further tomorrow unless someone else with more experience helps you out first.

Best wishes,
0 Kudos