<?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: Prevent OK Button from Closing Form? in ArcPad Questions</title>
    <link>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451224#M3220</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Suggestion:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Create a variable g_bAlreadyOpened which is set to false before the form is opened.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the onload event you check if this variable is false, if so, you do all the initial stuff and set the g_bAlreadyOpened to true&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Otherwise you skip all the stuff that is done in the onload routine&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Use the onunload event to check if g_bAlreadyOpened is true, if so, open the form with the .Show method&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to actually close the form you need to set g_bAlreadyOpened to false in the OnCancel event&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rolf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Mar 2012 05:35:12 GMT</pubDate>
    <dc:creator>RolfBroch</dc:creator>
    <dc:date>2012-03-27T05:35:12Z</dc:date>
    <item>
      <title>Prevent OK Button from Closing Form?</title>
      <link>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451221#M3217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to prevent the OK button from shutting the form or I need a way to get rid of the OK button all together.&amp;nbsp; Anyone have any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the scenario.&amp;nbsp; The field teams collect data for multiple artefacts at one location.&amp;nbsp; I have it setup so that they can push a button and the data is written to a shapefile and the form is refreshed without closing so they can keep entering the next artefact without opening the form all over again.&amp;nbsp; The problem of course is that they on occasion hit the ok button instead which closes the form and then they have to re-open it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem I'm facing is that I can't use any of the onValidation&amp;nbsp; calls because technically everything should pass validation in order for the data to get written.&amp;nbsp; I can't figure out how to get everything to pass validation then write all the data and then prevent the form from closing. Any help would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 03:41:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451221#M3217</guid>
      <dc:creator>DanikBourdeau</dc:creator>
      <dc:date>2012-03-23T03:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OK Button from Closing Form?</title>
      <link>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451222#M3218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Danik,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps I am missing something but couldn't you jsut add Applet.Forms("FORM").show(); to the onOk event for the form this would just open the form again??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This would essentially make it as if the form never closed..&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 17:55:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451222#M3218</guid>
      <dc:creator>MatthewMurray1</dc:creator>
      <dc:date>2012-03-23T17:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OK Button from Closing Form?</title>
      <link>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451223#M3219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Matthew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion.&amp;nbsp; I had thought of doing this and I think at one time I did have it setup up this way but unfortunately it won't really work now.&amp;nbsp; I have quite a lot of things happening during the onLoad event and forcing the form to reopen all the time would probably mess things up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was hoping that someone had a magic trick up their sleeves to prevent the OK button from closing the form.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I can't find a way I may have to use your suggestion and rework my code; Pain.&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, 27 Mar 2012 02:27:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451223#M3219</guid>
      <dc:creator>DanikBourdeau</dc:creator>
      <dc:date>2012-03-27T02:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OK Button from Closing Form?</title>
      <link>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451224#M3220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Suggestion:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Create a variable g_bAlreadyOpened which is set to false before the form is opened.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the onload event you check if this variable is false, if so, you do all the initial stuff and set the g_bAlreadyOpened to true&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Otherwise you skip all the stuff that is done in the onload routine&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Use the onunload event to check if g_bAlreadyOpened is true, if so, open the form with the .Show method&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to actually close the form you need to set g_bAlreadyOpened to false in the OnCancel event&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rolf&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 05:35:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451224#M3220</guid>
      <dc:creator>RolfBroch</dc:creator>
      <dc:date>2012-03-27T05:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OK Button from Closing Form?</title>
      <link>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451225#M3221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Rolf,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Great Suggestion, it worked beautifully.&amp;nbsp; I did have to make a few changes to the code to ensure variables maintained their values once the form was restarted but it all seems to be working good.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The field teams will be happy!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's a short snippet of how I got it to work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Option Explicit
Dim g_bAlreadyOpened, XCoord, YCoord

g_bAlreadyOpened = False

Sub OnLoadForm
&amp;nbsp;&amp;nbsp; If g_bAlreadyOpened = False Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XCoord = Application.GPS.X
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YCoord = Application.GPS.Y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g_bAlreadyOpened = True
&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp; Applet.Forms("T1").Pages("Page1").Controls("Easting").Value = XCoord
&amp;nbsp;&amp;nbsp; Applet.Forms("T1").Pages("Page1").Controls("Northing").Value = YCoord
End Sub

Sub OnUnloadForm
&amp;nbsp;&amp;nbsp; If g_bAlreadyOpened = True Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XCoord = Applet.Forms("T1").Pages("Page1").Controls("Easting").Value
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YCoord = Applet.Forms("T1").Pages("Page1").Controls("Northing").Value
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Applet.Forms("T1").Show
&amp;nbsp;&amp;nbsp; End If
End Sub

Sub OnCancelForm
&amp;nbsp;&amp;nbsp; g_bAlreadyOpened = False
End Sub
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When the form first starts up controls 'Easting' and 'Northing' are populated based on their respective GPS coordinates but since the field teams frequently change the values (because the don't want to stand in a river for example) I had to make certain that any changes would follow through when the form is re-initialized from the OnLoadForm event.&amp;nbsp; By re-assigning variables XCoord and Y Coord before .Show, any changes made will follow through.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451225#M3221</guid>
      <dc:creator>DanikBourdeau</dc:creator>
      <dc:date>2021-12-11T20:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OK Button from Closing Form?</title>
      <link>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451226#M3222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe late to the party but here is how I do it. I set a the page's "OnValidate" event to a sub method. I check what I need on that page. If things are not right and I display a message saying so and set ThisEvent.Result = False so the form doesn't close. This way the form doesn't close and have to be reopened.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 19:28:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcpad-questions/prevent-ok-button-from-closing-form/m-p/451226#M3222</guid>
      <dc:creator>RobChouinard</dc:creator>
      <dc:date>2012-04-12T19:28:36Z</dc:date>
    </item>
  </channel>
</rss>

