<?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 add-in button - mouse down capture? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542368#M14683</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to built a add-in button which will need to get x,y from a mouse down click.&amp;nbsp; How do I do it? For example I have Function MouseDownXY so what I need to write on the button Sub Onclick() to make it go to my function?&amp;nbsp; I'm using vb.net.&amp;nbsp; Thank you very much for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function MouseDownXY(ByVal x As Long, ByVal y As Long)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pPoint = pMxApp.Display.DisplayTransformation.ToMapPoint(x, y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Jan 2011 18:13:40 GMT</pubDate>
    <dc:creator>helenchu</dc:creator>
    <dc:date>2011-01-14T18:13:40Z</dc:date>
    <item>
      <title>add-in button - mouse down capture?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542368#M14683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to built a add-in button which will need to get x,y from a mouse down click.&amp;nbsp; How do I do it? For example I have Function MouseDownXY so what I need to write on the button Sub Onclick() to make it go to my function?&amp;nbsp; I'm using vb.net.&amp;nbsp; Thank you very much for your help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Function MouseDownXY(ByVal x As Long, ByVal y As Long)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pPoint = pMxApp.Display.DisplayTransformation.ToMapPoint(x, y)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 18:13:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542368#M14683</guid>
      <dc:creator>helenchu</dc:creator>
      <dc:date>2011-01-14T18:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: add-in button - mouse down capture?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542369#M14684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: rwelikal&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, you can make a TOOL or you can make a command.. a TOOL will initiate the code when you CLICK the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would draw a point on click using the ESRI snippet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub DrawPoint(ByVal activeView As ESRI.ArcGIS.Carto.IActiveView, ByVal x As System.Int32, ByVal y As System.Int32)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If activeView Is Nothing Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim screenDisplay As ESRI.ArcGIS.Display.IScreenDisplay = activeView.ScreenDisplay

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Constant
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; screenDisplay.StartDrawing(screenDisplay.hDC, CShort(ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim simpleMarkerSymbol As ESRI.ArcGIS.Display.ISimpleMarkerSymbol = New ESRI.ArcGIS.Display.SimpleMarkerSymbolClass

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim symbol As ESRI.ArcGIS.Display.ISymbol = TryCast(simpleMarkerSymbol, ESRI.ArcGIS.Display.ISymbol) ' Dynamic Cast
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; screenDisplay.SetSymbol(symbol)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim displayTransformation As ESRI.ArcGIS.Display.IDisplayTransformation = screenDisplay.DisplayTransformation

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' X and Y are in device coordinates
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim point As ESRI.ArcGIS.Geometry.IPoint = displayTransformation.ToMapPoint(x, y)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; screenDisplay.DrawPoint(point)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; screenDisplay.FinishDrawing()

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I would use another snippet and use that point to get the click location:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Function GetMapCoordinatesFromScreenCoordinates(ByVal screenPoint As ESRI.ArcGIS.Geometry.IPoint, ByVal activeView As ESRI.ArcGIS.Carto.IActiveView) As ESRI.ArcGIS.Geometry.IPoint

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If screenPoint Is Nothing OrElse screenPoint.IsEmpty OrElse activeView Is Nothing Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return Nothing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim screenDisplay As ESRI.ArcGIS.Display.IScreenDisplay = activeView.ScreenDisplay
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim displayTransformation As ESRI.ArcGIS.Display.IDisplayTransformation = screenDisplay.DisplayTransformation

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return displayTransformation.ToMapPoint(CInt(screenPoint.X), CInt(screenPoint.Y))

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:30:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542369#M14684</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T23:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: add-in button - mouse down capture?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542370#M14685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much.&amp;nbsp; Yes you did help alot just by the word "TOOL"&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jan 2011 20:47:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542370#M14685</guid>
      <dc:creator>helenchu</dc:creator>
      <dc:date>2011-01-18T20:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: add-in button - mouse down capture?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542371#M14686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: ellmenreich&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;by using the addins i must choose tool or button. i will convert my 9.3 c# code to addin and will prevent an installer with registrations. so in 9.3 i have a tool wich inherit from basetool. the tool opens a form in the onclick method. in the mouse down events i capture the geometry and send it to the form. the new addins tool did not have a onclick method and the button no onmousedown event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;also i cannot call the tool from the form by setting application.currenttool = addins.tool because of it is no command.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so what is the new way to open a form, select somthing like geometrytype (point or line), enable any kind (drawing or editing) of digitze and get back the new geometry to form.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2011 08:07:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/add-in-button-mouse-down-capture/m-p/542371#M14686</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2011-03-01T08:07:11Z</dc:date>
    </item>
  </channel>
</rss>

