<?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: C# OnMouseDown returning an IPoint? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474849#M12860</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It crashes if&amp;nbsp; you dont add the GetCoord tool on arcmap. Good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Mar 2012 19:28:29 GMT</pubDate>
    <dc:creator>sapnas</dc:creator>
    <dc:date>2012-03-29T19:28:29Z</dc:date>
    <item>
      <title>C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474841#M12852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm a newbie to developping add-ins in C#, probably mixing many concepts and principles...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have built a simple tool that gets the coordinates when the user clicks on the map.&amp;nbsp; For now, I have a GetCoord.cs file with the following code : &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.Geometry; //For geometry IPoint
using ESRI.ArcGIS.Carto; //For ActiveView
using ESRI.ArcGIS.Display; //For IScreenDisplay


namespace myProject
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public class GetCoord: ESRI.ArcGIS.Desktop.AddIns.Tool
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public GetCoord()
&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; protected override void OnUpdate()
&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; protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
&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; try
&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; //Get the active view
&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; IActiveView activeView = ArcMap.Document.ActiveView;
&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; IScreenDisplay screenDisplay = activeView.ScreenDisplay;

&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; //Get the point when the user clicks 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; IPoint myPoint = screenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);
&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; System.Windows.Forms.MessageBox.Show("X coordinate from the IPoint: " + myPoint.X);
&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; System.Windows.Forms.MessageBox.Show("Y coordinate fom the IPoint: " + myPoint.Y);
&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; catch (Exception e)
&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; System.Windows.Forms.MessageBox.Show("Problem to get the coordinates: " + e.Message);
&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; }
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This codes works, I have the tool on my toolbar, I click on the tool and then on the map, and the coordinates are written in the message box. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I would like to do next is to use this tool within other methods and classes, to use the coordinates for different purposes.&amp;nbsp; For instance, I would like to create a NewPoint.cs button, which would call the GetCoord.OnMouseDown() function and use the provided coordinates to create a new point in a feature class.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was therefore wondering if I could modify my code to get something like this : &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
public override IPoint OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; //Get the active view
&amp;nbsp;&amp;nbsp;&amp;nbsp; IActiveView activeView = ArcMap.Document.ActiveView;
&amp;nbsp;&amp;nbsp;&amp;nbsp; IScreenDisplay screenDisplay = activeView.ScreenDisplay;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //Get the point when the user clicks on the map
&amp;nbsp;&amp;nbsp;&amp;nbsp; IPoint myPoint = screenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);
&amp;nbsp;&amp;nbsp;&amp;nbsp; return myPoint;
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and then, later in another cs file : &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Ipoint myNewPoint = GetCoord.OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2012 18:11:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474841#M12852</guid>
      <dc:creator>LucieBoucher1</dc:creator>
      <dc:date>2012-03-28T18:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474842#M12853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I have understood right you want to store the coordinates every time there is a mouse click event. If so, you can declare a static point variable in your addin tool which gets populated in mouse click event and could be accessed as GetCoord.NewPoint. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.Geometry; //For geometry IPoint
using ESRI.ArcGIS.Carto; //For ActiveView
using ESRI.ArcGIS.Display; //For IScreenDisplay

namespace myProject
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public class GetCoord: ESRI.ArcGIS.Desktop.AddIns.Tool
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color:#ff0000;"&gt;private static IPoint newpoint = null;&lt;/SPAN&gt;
&lt;SPAN style="color:#ff0000;"&gt;&amp;nbsp;&amp;nbsp; public static IPoint NewPoint
&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; get { return newpoint; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;
 
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public GetCoord()
&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; protected override void OnUpdate()
&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; protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
&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; try
&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; &lt;SPAN style="color:#ff0000;"&gt; if(newpoint == null)
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newpoint = new Point();
&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;&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; newpoint.PutCoords(arg.X,arg.Y);
&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Get the active view
&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; IActiveView activeView = ArcMap.Document.ActiveView;
&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; IScreenDisplay screenDisplay = activeView.ScreenDisplay;
&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; //Get the point when the user clicks 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; IPoint myPoint = screenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);
&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; System.Windows.Forms.MessageBox.Show("X coordinate from the IPoint: " + myPoint.X);
&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; System.Windows.Forms.MessageBox.Show("Y coordinate fom the IPoint: " + myPoint.Y);
&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; catch (Exception e)
&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; System.Windows.Forms.MessageBox.Show("Problem to get the coordinates: " + e.Message);
&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; }
}

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:59:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474842#M12853</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2021-12-11T20:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474843#M12854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried your solution.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My GetCoord.cs file now looks like this : &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.Geometry; //For the IPoint

namespace myProject
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public class GetCoord : ESRI.ArcGIS.Desktop.AddIns.Tool
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static IPoint newpoint = null;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static IPoint NewPoint
&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; get { return newpoint; }
&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; public GetCoord()
&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; protected override void OnUpdate()
&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; protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
&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; try
&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; if (newpoint == null)
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newpoint = new Point();
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; newpoint.PutCoords(arg.X, arg.Y);

&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; catch (Exception e)
&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; System.Windows.Forms.MessageBox.Show("Problem to get coordinates : " + e.Message);
&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; }

}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I tried to call the point within another cs file with this code&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
IPoint newLocation = GetCoord.NewPoint;
System.Windows.Forms.MessageBox.Show("X Coordinate: " + newLocation.X);
System.Windows.Forms.MessageBox.Show("Y Coordinate: " + newLocation.Y);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but I get the following error message : &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Non-invocable member myProject.GetCoord.NewPoint cannot be used like a method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any clue?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:59:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474843#M12854</guid>
      <dc:creator>LucieBoucher1</dc:creator>
      <dc:date>2021-12-11T20:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474844#M12855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Prior to invoking the point in another cs file did you select the GetCoord tool and clicked the mouse on the map. Do you want to reuse the method or do you want to access the points returned by GetCoord tool?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you also post the cs file invoking&amp;nbsp; GetCoord.NewPoint?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2012 20:37:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474844#M12855</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2012-03-28T20:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474845#M12856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;sshetty said :&lt;BR /&gt;Prior to invoking the point in another cs file did you select the GetCoord tool and clicked the mouse on the map. &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Indeed, I had not.&amp;nbsp; When I click on the GetCoord tool, then click on the map, and then on my NewLocation button, I get the apropriate coordinates. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, would it be possible to skip the click on the GetCoord tool?&amp;nbsp; What I would like is to have the user click on my NewLocation button, then click on the map, and have the process done.&amp;nbsp; In other words, is it possible to call the GetCoord tool within the NewLocation.OnClick function?&amp;nbsp; In an ideal world, the GetCoord would not appear on my toolbar, it would only be a tool used within other buttons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2012 20:45:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474845#M12856</guid>
      <dc:creator>LucieBoucher1</dc:creator>
      <dc:date>2012-03-28T20:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474846#M12857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you are using Addin button then add below code in onclick method where "ID" is GetCoord id in Config.esriaddinx. Current tool will automatically invoke mouse down event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

&lt;SPAN style="color: #2b91af; font-size: 2;"&gt;&lt;SPAN style="color:#222222;"&gt;ICommandItem cmd = ArcMap.Application.Document.CommandBars.Find("ID", false, false);
&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; ArcMap.Application.CurrentTool = cmd;&lt;/SPAN&gt;
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:59:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474846#M12857</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2021-12-11T20:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474847#M12858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your new location tool would have its' own onMouseDown implementation where you would put that same code in it.&amp;nbsp;&amp;nbsp; The method is designed to be invoked by ArcMap when you mouse down on the map with your tool. You could write a static method that took in the mouseenventargs and the screendisplay as arguments and returns a point, but I don't think it is worth it.&amp;nbsp; It is only a few lines of code and making a new function for it seems like a hassle.&amp;nbsp; In my opinion code reuse is rarely worth the trouble and modularity in code is much more handy even if it means writing a few lines of code over and over.&amp;nbsp; If you really want to, you can make an abstract class that implements mouseenventargs and the tool interface and then inherit the class, but to me that seems like using a cannon to go after flies.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 16:48:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474847#M12858</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2012-03-29T16:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474848#M12859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Your new location tool would have its' own onMouseDown implementation where you would put that same code in it.&amp;nbsp;&amp;nbsp; The method is designed to be invoked by ArcMap when you mouse down on the map with your tool. You could write a static method that took in the mouseenventargs and the screendisplay as arguments and returns a point, but I don't think it is worth it.&amp;nbsp; It is only a few lines of code and making a new function for it seems like a hassle.&amp;nbsp; In my opinion code reuse is rarely worth the trouble and modularity in code is much more handy even if it means writing a few lines of code over and over.&amp;nbsp; If you really want to, you can make an abstract class that implements mouseenventargs and the tool interface and then inherit the class, but to me that seems like using a cannon to go after flies.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see.&amp;nbsp; I therefore understand that I will not create a New Location &lt;/SPAN&gt;&lt;STRONG&gt;button&lt;/STRONG&gt;&lt;SPAN&gt;, but a New Location &lt;/SPAN&gt;&lt;STRONG&gt;tool&lt;/STRONG&gt;&lt;SPAN&gt;...&amp;nbsp; Not that it changes much in the end, but I need to start with the right structure.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;If you are using Addin button then add below code in onclick method where "ID" is GetCoord id in Config.esriaddinx. Current tool will automatically invoke mouse down event.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;ICommandItem cmd = ArcMap.Application.Document.CommandBars.Find("ID", false, false);
&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; ArcMap.Application.CurrentTool = cmd;&lt;/PRE&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried your solution, but my code now crashed ArcGIS.&amp;nbsp; Thank you very much for your help and for the time you took to answer.&amp;nbsp; I believe I will go with Alexander's suggestion and save myself trouble by copying the function through all the tools that require it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:59:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474848#M12859</guid>
      <dc:creator>LucieBoucher1</dc:creator>
      <dc:date>2021-12-11T20:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474849#M12860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It crashes if&amp;nbsp; you dont add the GetCoord tool on arcmap. Good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 19:28:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474849#M12860</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2012-03-29T19:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474850#M12861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;BTW you still have to copy&amp;nbsp; the Mouse down event code in all the tools. The advantage of reusability is less code and errors can be quickly identified and eliminated. Basically fixing&amp;nbsp; bug in one class versus&amp;nbsp; fixing the same bug in multiple classes. Ofcourse reusability depends on case by case basis.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 19:57:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474850#M12861</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2012-03-29T19:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474851#M12862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are some different philosophy and reusability.&amp;nbsp; The advantages a real and it makes sense in some cases but there are disadvantages too.&amp;nbsp; If the code is only a few lines, the probability of error in the code is low so the fixing it one place fixes all is not always applicable.&amp;nbsp; There is also the risk of changing one function breaks all the others...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If your code is crashing ArcMap, you need to put exception handlers in it.&amp;nbsp; Any event called by ArcMap (ie any implementation of ArcObjects interfaces) should have exception handlers.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2012 14:06:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474851#M12862</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2012-03-30T14:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474852#M12863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In fact if it is few lines of code it is always good to reuse it. Imagine repeating those few lines of code in multiple places. Let's say there is custom tool and you want to incorporate that same functionality in another tool bar or standalone application. Would you rewrite it or reuse the existing tool? But then like I said it varies on case by case basis.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2012 14:33:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474852#M12863</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2012-03-30T14:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474853#M12864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would most likely copy/paste the tool so yes two or more copies.&amp;nbsp; The problem I find is requirements change over time and functions need to be tweaked for various reasons.&amp;nbsp; If the code is centralized in one function it makes it harder to follow someone else's or my train of though from a long time ago.&amp;nbsp; I like to keep things simple in one class even if that means more code overall.&amp;nbsp; It means you can move that class to another project without dragging 5 or 6 utility classes that contain hundreds of methods when you only need one in each...&amp;nbsp; I just spent a day going through an ArcObjectsUtil class that had 6000 lines of code done by another programmer that is not here any more.&amp;nbsp; I found out that 70% of the methods weren't called by anything any more.&amp;nbsp; Meaning that we had almost 4000 lines of code being maintained and cluttering up the project for no good reason.&amp;nbsp; Some of the code was to convert one type of list to another, 1 line of code with a lambda expression with Framework 3.5...&amp;nbsp;&amp;nbsp; Reusability is fine but there are specific ways of doing it such has inheritance or class extensions that make it work nicely but you have to think of the poor guy coming after you, is he/she going to be able to make any sense of it...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2012 15:09:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474853#M12864</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2012-03-30T15:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474854#M12865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The segment of source code is reused only if it has slight or no modification. You dont consider reusability if the requirement changes significantly and is not common among different parts. Hence I stated it depends on case by case basis. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Regarding your statement about dragging 5 or 6 utilities, when you are utilizing the ESRI APIs they have several classes packaged in one class library. How would you move each class from those libraries which has hundreds of methods when you only need one in each and 70% of the methods are not used in your application ? Classic example of reusable components is arcobjects which is written in c++ and is reused in several programming languages.&amp;nbsp; They are maintaining&amp;nbsp; and modifying the legacy code instead of completely migrating it because it is too much of an effort and time.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2012 18:46:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474854#M12865</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2012-03-30T18:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474855#M12866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Of course it is all case by case but my point is reuse is just one of the things to think about when programming and it usually shouldn't be the first.&amp;nbsp; I have worked for people who kept insisting on writing code with reuse in mind.&amp;nbsp; In my opinion reducing code complexity is a much more important consideration, in most cases.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2012 19:30:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474855#M12866</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2012-03-30T19:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474856#M12867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a form with a button on it. The button's click event activates a tool which in turn gets the a point object. My question is how can the form get the point from the tool so that the x and y values can be used in the form?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Robert&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Sep 2012 21:43:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474856#M12867</guid>
      <dc:creator>RobertPincus</dc:creator>
      <dc:date>2012-09-09T21:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474857#M12868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a form with a button on it. The button's click event activates a tool which in turn gets the a point object. My question is how can the form get the point from the tool so that the x and y values can be used in the form?&lt;BR /&gt;&lt;BR /&gt;Robert&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;One solution is to write a generic tool that allows the user to click the map (or draw a rectangle, a line, a circle, a polygon or whatever).&amp;nbsp; The tool would then fire an event and pass in the geometry as one of the arguments.&amp;nbsp; The code behind your form would include an event handler for this event that does whatever you need to do with that point geometry (for example, select a feature on a certain layer and populate controls with its attributes).&amp;nbsp; The code behind the button would create a new instance of your tool, subscribe to its event and activate the tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 13:59:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474857#M12868</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-09-10T13:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474858#M12869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know how to create a tool that fires an event to open a form. What I want to do is go the other way. Have a form with a button&amp;nbsp; activate a tool. Have the user click on the map and pass the coordinates back to the form. I tried to follow your narratives on how to do that, but this seems complex. Would you have a simple example that you could share.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Robert&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2012 13:36:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474858#M12869</guid>
      <dc:creator>RobertPincus</dc:creator>
      <dc:date>2012-09-11T13:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: C# OnMouseDown returning an IPoint?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474859#M12870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is how I've done it in my VB.Net add-in project. I have a form with several options of different types of features that can be created.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]17601[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a tool called DrawTool that contains the code for the OnMouseDown sub that captures the feature that is drawn.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Public Class DrawTool
&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits ESRI.ArcGIS.Desktop.AddIns.Tool

&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Public LineType As String
&amp;nbsp;&amp;nbsp;&amp;nbsp; Private m_LineFeedback As ESRI.ArcGIS.Display.INewBezierCurveFeedback = Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp; Private graphicsContainer As ESRI.ArcGIS.Carto.IGraphicsContainer

&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub New()

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub

&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Overrides Sub OnUpdate()

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub

&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Overrides Sub OnMouseDown(ByVal arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyBase.OnMouseDown(arg)

'etc
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the code for the buttons on my form.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp; Private Sub Draw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPoint.Click, btnLocation.Click, btnPolygon.Click, btnFreehand.Click, btnRectangle.Click

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pUID As New ESRI.ArcGIS.esriSystem.UID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pUID.Value = My.ThisAddIn.IDs.DrawTool
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pCommandItem = m_application.Document.CommandBars.Find(pUID, False, False)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Case sender.name
&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; Case "btnPoint"
&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; 'code to do some things for the Point tool
&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; Case "btnLocation"
&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; 'code to do some things for the Location tool
&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; 'etc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Select

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_application.CurrentTool = pCommandItem


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:59:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/c-onmousedown-returning-an-ipoint/m-p/474859#M12870</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T20:59:53Z</dc:date>
    </item>
  </channel>
</rss>

