<?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 FindNearestXY from GPS or pointer in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/findnearestxy-from-gps-or-pointer/m-p/66370#M447</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;SPAN&gt;How can I use code to identify whether a point was added using the GPS or the stylus? Right now, when a user creates a new point with the stylus, an attribute value from an underlying shapefile at that location is stored in a variable and then entered in a control on another shapefile. The stylus method works fine, but I need to allow the user to add a new point using the GPS tool. I was thinking of using an If...then statement, but I don't know how to recognize X/Y coordinates collected using a stylus vs. GPS. I use the following code for the stylus:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;cRS.BookMark=Application.Map.SelectionBookmark
&amp;nbsp; Set cShape=cRS.Fields.Shape
...
...
gRec=gRS.FindNearestXY(cShape.x, cShape.y)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To determine if the point was added with a stylus or GPS I tried the following, but the stylus method always returns the value of where the GPS is currently located and not where the stylus was tapped.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;If GPS.x&amp;gt;0 then
&amp;nbsp; dblX=GPS.x
&amp;nbsp; dblY=GPS.y
 Else
&amp;nbsp; cRS.BookMark=Application.Map.SelectionBookmark
&amp;nbsp; Set cShape=cRS.Fields.Shape
 End If 
...
...
If GPS.x&amp;gt;0 then '
&amp;nbsp; gRec=gRS.FindNearestXY(GPS.x, GPS.y) '
 Else '
&amp;nbsp; gRec=gRS.FindNearestXY(cShape.x, cShape.y)
 End If '&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My intent is to allow the user to collect a point with a stylus even when the GPS receiver is on. IsValidFix and IsOpen automatically generate GPS.x and GPS.y when I want to wait until the user taps the GPS point button before populating GPS.x and GPS.y. I thought about the OnPosition event, but know how to use that in code. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any guidance would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Charlotte&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Apr 2010 02:07:25 GMT</pubDate>
    <dc:creator>CharlottePeters</dc:creator>
    <dc:date>2010-04-24T02:07:25Z</dc:date>
    <item>
      <title>FindNearestXY from GPS or pointer</title>
      <link>https://community.esri.com/t5/arcpad-questions/findnearestxy-from-gps-or-pointer/m-p/66370#M447</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;SPAN&gt;How can I use code to identify whether a point was added using the GPS or the stylus? Right now, when a user creates a new point with the stylus, an attribute value from an underlying shapefile at that location is stored in a variable and then entered in a control on another shapefile. The stylus method works fine, but I need to allow the user to add a new point using the GPS tool. I was thinking of using an If...then statement, but I don't know how to recognize X/Y coordinates collected using a stylus vs. GPS. I use the following code for the stylus:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;cRS.BookMark=Application.Map.SelectionBookmark
&amp;nbsp; Set cShape=cRS.Fields.Shape
...
...
gRec=gRS.FindNearestXY(cShape.x, cShape.y)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To determine if the point was added with a stylus or GPS I tried the following, but the stylus method always returns the value of where the GPS is currently located and not where the stylus was tapped.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;If GPS.x&amp;gt;0 then
&amp;nbsp; dblX=GPS.x
&amp;nbsp; dblY=GPS.y
 Else
&amp;nbsp; cRS.BookMark=Application.Map.SelectionBookmark
&amp;nbsp; Set cShape=cRS.Fields.Shape
 End If 
...
...
If GPS.x&amp;gt;0 then '
&amp;nbsp; gRec=gRS.FindNearestXY(GPS.x, GPS.y) '
 Else '
&amp;nbsp; gRec=gRS.FindNearestXY(cShape.x, cShape.y)
 End If '&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My intent is to allow the user to collect a point with a stylus even when the GPS receiver is on. IsValidFix and IsOpen automatically generate GPS.x and GPS.y when I want to wait until the user taps the GPS point button before populating GPS.x and GPS.y. I thought about the OnPosition event, but know how to use that in code. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any guidance would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Charlotte&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Apr 2010 02:07:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/findnearestxy-from-gps-or-pointer/m-p/66370#M447</guid>
      <dc:creator>CharlottePeters</dc:creator>
      <dc:date>2010-04-24T02:07:25Z</dc:date>
    </item>
    <item>
      <title>FindNearestXY from GPS or pointer</title>
      <link>https://community.esri.com/t5/arcpad-questions/findnearestxy-from-gps-or-pointer/m-p/66371#M448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is this what you are looking for?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Sub CapturePointerXY()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Get X,Y From Pointer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim X, Y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; X = Map.PointerX
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y = Map.PointerY
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Do something with this captured location
End Sub
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I did was setup a new toolbutton and called "CapturePointerXY" from the "onpointerup" event. This makes a custom PointerMode the same name of the toolbutton. Search "PointerMode" on the ArcPad Help Index for more info on PointerModes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:33:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/findnearestxy-from-gps-or-pointer/m-p/66371#M448</guid>
      <dc:creator>RobChouinard</dc:creator>
      <dc:date>2021-12-10T22:33:49Z</dc:date>
    </item>
  </channel>
</rss>

