<?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: UI_BUTTON problem in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/UI-BUTTON-problem/m-p/253385#M6540</link>
    <description>Hi Jrantala,&lt;BR /&gt;
&lt;BR /&gt;
This happens because the parameter script can be run multiple times, thus resulting in the calculation occurring twice or more. I had this exact problem last year and it's a simple solution. &lt;A href="http://archicad-talk.graphisoft.com/viewtopic.php?p=238609&amp;amp;highlight=#238609" target="_blank"&gt;Here is the topic&lt;/A&gt; I started. It has a working object in my last reply. Essentially you need to insert the code below from Michael Rensing (&lt;A href="http://archicad-talk.graphisoft.com/viewtopic.php?t=34828&amp;amp;start=0&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;highlight=isfirstrun" target="_blank"&gt;Found in this topic&lt;/A&gt;) which only runs part of the script if it is the first time the script is being run. &lt;BR /&gt;

&lt;BLOCKQUOTE&gt;Michael wrote:&lt;BR /&gt;
This should do it. 
&lt;BLOCKQUOTE&gt;Code:&lt;BR /&gt;
&lt;BR /&gt;
   n = APPLICATION_QUERY ("PARAMETER_SCRIPT", "FIRSTOCCASION_IN_PROGRESS", isFirstRun) &lt;BR /&gt;
   IF isFirstRun THEN &lt;BR /&gt;
      A=A+1 &lt;BR /&gt;
   ELSE &lt;BR /&gt;
      A=A &lt;BR /&gt;
   ENDIF &lt;/BLOCKQUOTE&gt;
&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Wed, 18 Jan 2017 23:16:06 GMT</pubDate>
    <dc:creator>Lachlan Green</dc:creator>
    <dc:date>2017-01-18T23:16:06Z</dc:date>
    <item>
      <title>UI_BUTTON problem</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/UI-BUTTON-problem/m-p/253384#M6539</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;Hey,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to use UI_BUTTON to run a sub script. I see the only way to do this is to check the value of GLOB_UI_BUTTON in master script and then do a GOSUB. &lt;BR /&gt;
&lt;BR /&gt;
The problem here is that I can't reset GLOB_UI_BUTTON so it will do the function for multiple times every time the master script is ran. If I add a check to see if the GLOB_UI_BUTTON has changed or not, it won't have this problem, but then nothing happens if I want to press one button more than once in a row.&lt;BR /&gt;
&lt;BR /&gt;
Is there any way to do this? It would be much easier if you could add a function directly into the button script like this:
&lt;PRE&gt;UI_BUTTON GOSUB "my_function", text, x, y [, width, height, id]&lt;/PRE&gt;
But the documentation here doesn't say its possible: &lt;A href="http://gdl.graphisoft.com/gdl-docs/gdl-guide/chapter-9-non-geometric-scripts/the-user-interface-script/" target="_blank"&gt;&lt;LINK_TEXT text="http://gdl.graphisoft.com/gdl-docs/gdl- ... ce-script/"&gt;http://gdl.graphisoft.com/gdl-docs/gdl-guide/chapter-9-non-geometric-scripts/the-user-interface-script/&lt;/LINK_TEXT&gt;&lt;/A&gt;&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Jan 2017 11:50:23 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/UI-BUTTON-problem/m-p/253384#M6539</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-03T11:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: UI_BUTTON problem</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/UI-BUTTON-problem/m-p/253385#M6540</link>
      <description>Hi Jrantala,&lt;BR /&gt;
&lt;BR /&gt;
This happens because the parameter script can be run multiple times, thus resulting in the calculation occurring twice or more. I had this exact problem last year and it's a simple solution. &lt;A href="http://archicad-talk.graphisoft.com/viewtopic.php?p=238609&amp;amp;highlight=#238609" target="_blank"&gt;Here is the topic&lt;/A&gt; I started. It has a working object in my last reply. Essentially you need to insert the code below from Michael Rensing (&lt;A href="http://archicad-talk.graphisoft.com/viewtopic.php?t=34828&amp;amp;start=0&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;highlight=isfirstrun" target="_blank"&gt;Found in this topic&lt;/A&gt;) which only runs part of the script if it is the first time the script is being run. &lt;BR /&gt;

&lt;BLOCKQUOTE&gt;Michael wrote:&lt;BR /&gt;
This should do it. 
&lt;BLOCKQUOTE&gt;Code:&lt;BR /&gt;
&lt;BR /&gt;
   n = APPLICATION_QUERY ("PARAMETER_SCRIPT", "FIRSTOCCASION_IN_PROGRESS", isFirstRun) &lt;BR /&gt;
   IF isFirstRun THEN &lt;BR /&gt;
      A=A+1 &lt;BR /&gt;
   ELSE &lt;BR /&gt;
      A=A &lt;BR /&gt;
   ENDIF &lt;/BLOCKQUOTE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 18 Jan 2017 23:16:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/UI-BUTTON-problem/m-p/253385#M6540</guid>
      <dc:creator>Lachlan Green</dc:creator>
      <dc:date>2017-01-18T23:16:06Z</dc:date>
    </item>
  </channel>
</rss>

