<?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: How to I trigger an event based on the status of a pushbutton? in LabVIEW</title>
    <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1227270#M521950</link>
    <description>&lt;P&gt;altenbach,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much!&amp;nbsp; Your code is not the perfect solution to my current needs, but I saved it for future reference.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Aug 2010 20:08:43 GMT</pubDate>
    <dc:creator>diarmaede</dc:creator>
    <dc:date>2010-08-25T20:08:43Z</dc:date>
    <item>
      <title>How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1225544#M521581</link>
      <description>&lt;P&gt;I am trying to trigger an event based on the ON/OFF status of a pushbutton.&amp;nbsp; When I click the pushbutton to the ON position, I want the event structure in a loop to trigger on each iteration until the pushbutton goes back to the OFF position, either manually or programatically.&amp;nbsp; Is there an easy way to accomplish this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2010 15:44:33 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1225544#M521581</guid>
      <dc:creator>diarmaede</dc:creator>
      <dc:date>2010-08-24T15:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1225564#M521583</link>
      <description>&lt;P&gt;Add the timeout event to your button event, keep the timeout in a shift register, and set the timeout to a short value if the boolean is true and to -1 (infinite) if the button is false.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2010 15:55:58 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1225564#M521583</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-08-24T15:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1225748#M521623</link>
      <description>&lt;P&gt;Is an event structure absolutely necessary?&amp;nbsp; This is so simple with just a case structure, as in figure 1.&amp;nbsp; If you have to use an event structure, you could put the case structure with the pushbutton inside the Timeout event, as shown in Figure 2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/22270iC1C355BA71FC4E1B/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="22270iC1C355BA71FC4E1B" title="Example_VI_BD.png" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2010 18:39:41 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1225748#M521623</guid>
      <dc:creator>tbob</dc:creator>
      <dc:date>2010-08-24T18:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1225844#M521652</link>
      <description>&lt;P&gt;Here's what I had in mind... (LV 8.5).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2010 19:45:24 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1225844#M521652</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-08-24T19:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1227266#M521948</link>
      <description>&lt;P&gt;I ended up going with code that looked similar to the code tbob posted.&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2010 20:07:48 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1227266#M521948</guid>
      <dc:creator>diarmaede</dc:creator>
      <dc:date>2010-08-25T20:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1227270#M521950</link>
      <description>&lt;P&gt;altenbach,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much!&amp;nbsp; Your code is not the perfect solution to my current needs, but I saved it for future reference.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2010 20:08:43 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1227270#M521950</guid>
      <dc:creator>diarmaede</dc:creator>
      <dc:date>2010-08-25T20:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228329#M522172</link>
      <description>&lt;P&gt;How about using the Mouse Down event on your Push Button in the event structure? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2010 15:05:53 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228329#M522172</guid>
      <dc:creator>JHourigan</dc:creator>
      <dc:date>2010-08-26T15:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228425#M522187</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/22772"&gt;@JHourigan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;How about using the Mouse Down event on your Push Button in the event structure? &amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2010 15:54:45 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228425#M522187</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-08-26T15:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228533#M522220</link>
      <description>&lt;P&gt;If I want to simply detect a button push event.&amp;nbsp;I set the mechanical action of the boolean button to switch-until-released. Then I use the mouse down event structure on that button to detect the event. &amp;nbsp;It avoids having to include a case structure logic to address the state of the boolean in an Value Change event structure. The button immediately returns to the false condition after release.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2010 16:56:23 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228533#M522220</guid>
      <dc:creator>JHourigan</dc:creator>
      <dc:date>2010-08-26T16:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228629#M522249</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;Well, lets read the original question:&lt;/BLOCKQUOTE&gt;
&lt;DIV style="color: #333333; font-family: Arial; font-size: 13px; background-color: #ffffff; line-height: 15px; font-weight: normal; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-repeat: no-repeat no-repeat; padding: 5px; margin: 0px;"&gt;
&lt;BLOCKQUOTE style="margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; padding-top: 10px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; quotes: none;"&gt;
&lt;HR style="background-color: #989898; color: #989898; height: 1px; border: 0px initial initial;" /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/117810"&gt;@diarmaede&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P style="padding: 0px; margin: 0px;"&gt;I am trying to trigger an event based on the ON/OFF status of a pushbutton.&amp;nbsp; When I click the pushbutton to the ON position, I want the event structure in a loop to trigger on each iteration until the pushbutton goes back to the OFF position, either manually or programatically.&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/DIV&gt;
&lt;BLOCKQUOTE&gt;I cannot see anything about "switch until released", only "click to ON" and "OFF manually or programmatically". That seems to be a plain switch action.&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/22772"&gt;@JHourigan&lt;/a&gt; wrote:&lt;BR /&gt;If I want to simply detect a button push event.&amp;nbsp;I set the mechanical action of the boolean button to switch-until-released. Then I use the mouse down event structure on that button to detect the event. &amp;nbsp;It avoids having to include a case structure logic to address the state of the boolean in an Value Change event structure. The button immediately returns to the false condition after release. 
&lt;HR /&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;So far you are not dealing with the OFF handling at all, which seems to be a requirement. There must be more to it that you mention to get this working as intended. The value of the boolean needs to be constantly monitored anyway, so it might be difficult to do things without a case structure. I am still confused about the logic of it all ....&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;You should really include a small working example VI so we can see what you are talking about. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Thanks!&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2010 17:36:51 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228629#M522249</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-08-26T17:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228637#M522251</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;a href="https://forums.ni.com/t5/user/viewprofilepage/user-id/22772"&gt;@JHourigan&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;If I want to simply detect a button push event.&amp;nbsp;I set the mechanical action of the boolean button to switch-until-released. Then I use the mouse down event structure on that button to detect the event. &amp;nbsp;It avoids having to include a case structure logic to address the state of the boolean in an Value Change event structure. The button immediately returns to the false condition after release.&lt;/P&gt;
&lt;HR /&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need to re-read the first post.&amp;nbsp; The OP wants to run something as long as the button is ON.&amp;nbsp; This calls for a mechanical action of switch when pressed or released.&amp;nbsp; He doesn't want to be holding the mouse down while his code runs.&amp;nbsp; Click once, ON.&amp;nbsp; Click again, OFF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your method is similar to using a latch when pressed/released and a value change event.&amp;nbsp; When the event fires, the button is read, and it goes back to its original state automatically.&amp;nbsp; There is no need to use a case structure to determine the state of the button.&amp;nbsp; The event gets fired and that is all that counts.&amp;nbsp; If you needed to perform different actions depending upon the button state, you would not use a latch type.&amp;nbsp; You would use a switch type, which is what the OP wants.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I like your solution whenever I need to use a local variable or a reference of the button since either of these cannot be used with a latch type switch.&amp;nbsp; In this case, using a switch until released and a mouse down (or up) event would work fine.&amp;nbsp; I prefer mouse up because if you make a mistake and catch it while still holding the mouse button down, you can move the mouse away from the switch and release the button, and no event occurs.&amp;nbsp; Same for switch/latch when released.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2010 17:41:39 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228637#M522251</guid>
      <dc:creator>tbob</dc:creator>
      <dc:date>2010-08-26T17:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228659#M522258</link>
      <description>&lt;P&gt;Yes...I shanked in reading the original post. Tbob's use of mouse up is clever...particularly given my&amp;nbsp;propensity to not pay attention.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2010 17:54:16 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/1228659#M522258</guid>
      <dc:creator>JHourigan</dc:creator>
      <dc:date>2010-08-26T17:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to I trigger an event based on the status of a pushbutton?</title>
      <link>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/4372580#M1285244</link>
      <description>&lt;P&gt;Check the program.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 09:10:45 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/How-to-I-trigger-an-event-based-on-the-status-of-a-pushbutton/m-p/4372580#M1285244</guid>
      <dc:creator>govindsankar</dc:creator>
      <dc:date>2024-05-15T09:10:45Z</dc:date>
    </item>
  </channel>
</rss>

