<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Passing a mouse click to do a query in Viewer in ArcGIS Viewer for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24960#M1475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I see what you mean with the other widgets map clicks....well, so I need to call that setMapAction method in my mapClickHandler function then and create the map graphic in another function which that method calls and from there I can pass that event.graphic.geometry on to my query.geometry and then queryTask methods?&amp;nbsp; The way the API works&amp;nbsp; and the way the Viewer widgets work is very different.&amp;nbsp; I'm looking in the Search and Draw widgets and I think I'm missing how the map mouse click initiates these functions with a map event listener...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry for the confusion, but I am very new to this.&amp;nbsp; If it's too much trouble you don't have to keep responding.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Apr 2012 19:05:37 GMT</pubDate>
    <dc:creator>ThomasMcCracken</dc:creator>
    <dc:date>2012-04-11T19:05:37Z</dc:date>
    <item>
      <title>Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24956#M1471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everyone in Flex Viewer world,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the Flex API to create my own query widget.&amp;nbsp; Part of the functionality I want is to click a polygon and perform the query like so in the Flex API:&amp;nbsp; &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/flex/samples/index.html#/Select_and_zoom/01nq0000003s000000/" rel="nofollow" target="_blank"&gt;http://help.arcgis.com/en/webapi/flex/samples/index.html#/Select_and_zoom/01nq0000003s000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, this functionality is enabled partly by this markup:&amp;nbsp; &amp;lt;esri:Map id="myMap" mapClick="mapClickHandler(event)"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I'm unable to simply add a markup to the Flex Viewer map for mapClick, how can I pass the map click event to the mapClickHandler function to work the same way?&amp;nbsp; I know the Viewer does this with the pop-ups but I'm unable to see how.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If anyone has any ideas or perhaps a couple snippets of code as an example I would appreciate it, thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thomas McCracken&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GIS Analyst&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Georgia Power&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 19:45:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24956#M1471</guid>
      <dc:creator>ThomasMcCracken</dc:creator>
      <dc:date>2012-04-10T19:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24957#M1472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; If you look at all other widgets you will notice that they DO NOT interact with the map by adding a mapClick event instead they use the drawTool and get the geometry (in your case a MapPoint) returned and then work with that. You can search most widgets for setMapAction and you will see how that function (built into all widgets that extend baseWidget) is expecting an action (i.e. DrawTool.MAPPOINT), a status (text can be ""), a symbol (to draw on the map), and a function to return the drawEvent to (where you use event.graphic.geometry to get the MapPoint drawn). Once you have the MapPoint (Geometry) you can see how this ties right back into the sample code you referenced.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't forget to &lt;/SPAN&gt;&lt;STRONG&gt;click the Mark as answer check&lt;/STRONG&gt;&lt;SPAN&gt; on this post and to &lt;/SPAN&gt;&lt;STRONG&gt;click the top arrow (promote)&lt;/STRONG&gt;&lt;SPAN&gt; as shown below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gis.calhouncounty.org/FlexViewer2.5/Answer.jpg"&gt;&lt;IMG src="http://gis.calhouncounty.org/FlexViewer2.5/Answer.jpg" /&gt;&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 19:59:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24957#M1472</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2012-04-10T19:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24958#M1473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Robert, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was having trouble implementing this solution so I then added a map Event Listener for a map click and then passed that event to the handler and everything ran fine.&amp;nbsp; Do you see a downside to this approach?&amp;nbsp; It was a very easy solution once I figured out where to add it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 17:31:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24958#M1473</guid>
      <dc:creator>ThomasMcCracken</dc:creator>
      <dc:date>2012-04-11T17:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24959#M1474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Yes the down side is that if your widget is opened it has the listener added to the map and then the user also opens another widget that activates the viewer drawTool they both will be executing on the map click event. If you do it the way I describe then when a new widget is opened and the setMapAction is called there is an event fired normally that deactivates other widgets listeners to the map.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 17:38:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24959#M1474</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2012-04-11T17:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24960#M1475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I see what you mean with the other widgets map clicks....well, so I need to call that setMapAction method in my mapClickHandler function then and create the map graphic in another function which that method calls and from there I can pass that event.graphic.geometry on to my query.geometry and then queryTask methods?&amp;nbsp; The way the API works&amp;nbsp; and the way the Viewer widgets work is very different.&amp;nbsp; I'm looking in the Search and Draw widgets and I think I'm missing how the map mouse click initiates these functions with a map event listener...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry for the confusion, but I am very new to this.&amp;nbsp; If it's too much trouble you don't have to keep responding.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thomas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 19:05:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24960#M1475</guid>
      <dc:creator>ThomasMcCracken</dc:creator>
      <dc:date>2012-04-11T19:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24961#M1476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; You don't see the mapclick event interaction because that is all hidden (included in the DrawTool). What you will find in the draw widget is there is a button that fires the setMapAction and the MapManager actually has the DrawTool defined and it adds and removes map click event listeners internally. Hope that sheds a little more light on this for you. So you lay out a road map for your widget, it would need a button that fires the activateDrawTool function below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import com.esri.ags.tools.DrawTool;
import com.esri.ags.events.DrawEvent;
import com.esri.ags.geometry.MapPoint;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private function activateDrawTool(event:MouseEvent):void
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; addSharedData("Deactivate_DrawTool", null); // to be able to deactivate drawTool on other widgets
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setMapAction(DrawTool.MAPPOINT, "My tool that does something", new SimpleMarkerSymbol("circle",12,0x0000ff,0.8), DrawEnd);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private function DrawEnd(event:DrawEvent):void
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //deactivates the drawTool
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; event.target.deactivate();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var geom:Geometry = event.graphic.geometry;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //If you want to persist the point on the map
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var gra:Graphic = new Graphic(geom, new SimpleMarkerSymbol("circle",12,0x0000ff,0.8));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphicsLayer.add(gra);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //snippet of code from the smaple
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.geometry = geom;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.execute(query);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:00:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24961#M1476</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-10T21:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24962#M1477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah, it's all internal.&amp;nbsp; I see now.&amp;nbsp; Thanks Robert! I believe I can get it working now!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 11:20:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24962#M1477</guid>
      <dc:creator>ThomasMcCracken</dc:creator>
      <dc:date>2012-04-12T11:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24963#M1478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to programmatically mimic the action of a user clicking a search result so the map is zoomed to the result?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 19:02:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24963#M1478</guid>
      <dc:creator>AshleyOwens</dc:creator>
      <dc:date>2012-04-30T19:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a mouse click to do a query in Viewer</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24964#M1479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is there a way to programmatically mimic the action of a user clicking a search result so the map is zoomed to the result?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;For anyone interested, I accomplished this by adding zoom logic to my onResult function within the queryFeaturesText function.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 18:17:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/passing-a-mouse-click-to-do-a-query-in-viewer/m-p/24964#M1479</guid>
      <dc:creator>AshleyOwens</dc:creator>
      <dc:date>2012-05-03T18:17:42Z</dc:date>
    </item>
  </channel>
</rss>

