<?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: Crash course in Event Structures in LabVIEW</title>
    <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/908385#M409276</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;DFGray wrote: &lt;BR /&gt;When I write a GUI based LabVIEW program, I usually create references to all the possibly visible controls and indicators (right click, create reference) and bundle them all up for later use.&amp;nbsp; I cache them with an appropriate reference object (shift register wire, single-element queue, or action engine depending on the application).&amp;nbsp; This allows me to easily do fairly complex things with the front panel without too much effort. &lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do the same!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;</description>
    <pubDate>Fri, 15 May 2009 13:35:47 GMT</pubDate>
    <dc:creator>Ben</dc:creator>
    <dc:date>2009-05-15T13:35:47Z</dc:date>
    <item>
      <title>Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899120#M405614</link>
      <description>&lt;P&gt;I have several VIs which just sit in While Loops during their 'idle'
state.&amp;nbsp; This allows data to be preserved in the shift registers, but
means that I have several controls and indicators that are being read
and written to in every iteration with a couple of VIs being called up
each time too.&amp;nbsp; I've had someone suggest I use Event Structures to only
do something when a FP object has a state/data change.&amp;nbsp; I've considered
this myself too, but have had no prior experience with them (nor have
any of my collegues) and the &lt;STRONG&gt;LabVIEW 6.1&lt;/STRONG&gt; help section on them is not
particularly enlightening.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if anyone
would be willing to give me a crash course in how, when and why to use
Event Structures, and perhaps include a bit of example code so i can
see them in operation.&amp;nbsp; If you haven't got lv6.1 then pictures will be
fine (as long as you don't use something i can't).&amp;nbsp; I'm happy to copy
things out if necessary &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope someone (anyone) will be
able to give me a hand here since I have rather limited time available
to learn their use.&amp;nbsp; It may turn out that they're not the best way of
executing my code, but I still need to be able to use them if possible!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;James &lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by James Mamakos on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 04-30-2009&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 07:49 AM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 30 Apr 2009 12:49:38 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899120#M405614</guid>
      <dc:creator>J.Mamakos</dc:creator>
      <dc:date>2009-04-30T12:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899138#M405618</link>
      <description>&lt;P&gt;From what I saw in the other thread, yes you are right an event structure can help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The tag &lt;A href="http://forums.ni.com/ni/tagging/view_tag?tag.text=LabVIEW_Event&amp;amp;tag.message_scope=all" target="_blank"&gt;"LabVIEW_Event"&lt;/A&gt; has some good threads to review.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;message.id=245990#M245990" target="_blank"&gt;This one &lt;/A&gt;goes into the working of the events structure and its subtlties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW: No I am not following you around. You are just asking good question and seem to want to learn LV.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2009 13:20:31 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899138#M405618</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2009-04-30T13:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899394#M405730</link>
      <description>&lt;P&gt;Thank you - there's a lot to read there, but I'm working my way through it!&amp;nbsp; I'll get back to you once i run out of reading material!&amp;nbsp; &lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://forums.ni.com/i/smilies/16x16_smiley-tongue.gif" alt="Smiley Tongue" title="Smiley Tongue" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm only 19 (just), and I'm on a working gap-year before going to uni in october.&amp;nbsp; I've been given a project to achieve using LabVIEW - most of out computers run on lv6.1 with a couple on lv8.5 - I think we even have an ancient machine running lv5... it can't handle anything more than that!&amp;nbsp; I've been working on it for about 4 months now, and my only prior programming knowledge came from a tiny bit of QBasic during my electronics A level.&amp;nbsp; I have to admit, I'm enjoying myself probably way too much with LabVIEW and I keep finding out how to do something else and then going off on a tangent - not too good for productivity, but i do stumble upon some useful tricks!&amp;nbsp; Pretty much everything I've learnt so far has been through experimentation -by far the best way to learn! &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S.&amp;nbsp; I don't mind you following me - just so long as you keep answering my questions!&amp;nbsp; &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.ni.com/i/smilies/16x16_smiley-wink.gif" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2009 18:28:20 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899394#M405730</guid>
      <dc:creator>J.Mamakos</dc:creator>
      <dc:date>2009-04-30T18:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899719#M405894</link>
      <description>Here is a quick tutorial on basic design you may find useful.&amp;nbsp; It includes an event structure and a mechanism for data storage.&amp;nbsp; The data storage mechanism is a bit dated.&amp;nbsp; I would recommend &lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;message.id=240328&amp;amp;query.id=72598#M240328" target="_blank"&gt;action engines&lt;/A&gt; or &lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;message.id=376861" target="_blank"&gt;single-element queues&lt;/A&gt; for current development (and you can use those in LabVIEW 6.1), but the basics are similar.&amp;nbsp; Unfortunately, the code is LabVIEW 7.0.&amp;nbsp; If you can't get time on the newer versions of LabVIEW, let me know and I will install 7.0 and save to 6.1 for you.</description>
      <pubDate>Fri, 01 May 2009 12:55:00 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899719#M405894</guid>
      <dc:creator>DFGray</dc:creator>
      <dc:date>2009-05-01T12:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899728#M405899</link>
      <description>&lt;P&gt;I'm afraid we run LabVIEW 8.5, 6.1, and 5.0.&amp;nbsp; I am not allowed on the computers with tthe more advanced version, so i am stuck with 6.1.&amp;nbsp; Would you (or anyone else) be able to convert this down one more level please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the additional help. &lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2009 13:19:10 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/899728#M405899</guid>
      <dc:creator>J.Mamakos</dc:creator>
      <dc:date>2009-05-01T13:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/900640#M406305</link>
      <description>Here it is in 6.1.&amp;nbsp; I do not have 6.1 installed, so was unable to check it.&amp;nbsp; All the VIs should be there, but linking may be a bit flaky.&amp;nbsp; Relink and save on first load and you should be OK.&amp;nbsp; Let me know if you run into problems.</description>
      <pubDate>Mon, 04 May 2009 14:20:05 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/900640#M406305</guid>
      <dc:creator>DFGray</dc:creator>
      <dc:date>2009-05-04T14:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/901656#M406646</link>
      <description>&lt;P&gt;Thank you for all this material.&amp;nbsp; I've a question about part of one of the VIs.&amp;nbsp; In the first image, you can see the event structure when the "exit" boolean has been pressed.&amp;nbsp; Why is there an empty false case here if the "exit" control must be true for the VI to even get as far as the case statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On a more general note, I've been reading about and playing with event structures, and I'm beginning to get to grips with them.&amp;nbsp; However, what is the advantage of having an event structure with several events over having a case structure with several cases (and an empty default case if no control has changed)? The second image shows one such case statement (case for no action is displayed).&amp;nbsp; The third shows a case statement that executes on one of many controls (false case is blank), and also shows another version of that shown in the second image (case statement for this is inside the sub VI).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whereas only one event structure is recommended (and advised) per VI, you can have several case statements working in parallel.&amp;nbsp; How can one customise an event structure to match the apparent speed of multiple parallel case statements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And about queues... Can you have more than one queue per VI, and what else (other than event structures) can use them?&amp;nbsp; What is their advantage over multiple separate controls?&amp;nbsp; Do they limit parallelism and/or speed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an aside, what (if any) is the operational difference between wiring a false constant to the 'continue if true' terminal of a while loop and wiring a true constant to the 'stop if true'? &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologise for all these questions (some of which must seem rather obvious).&amp;nbsp; I have and am scanning help sections and forum entries etc, but I'm not quite finding answers to everything.&amp;nbsp; All replies are greatly appreciated. &lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2009 17:10:33 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/901656#M406646</guid>
      <dc:creator>J.Mamakos</dc:creator>
      <dc:date>2009-05-05T17:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/901989#M406773</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;James Mamakos wrote: &lt;BR /&gt;&lt;P&gt;Thank you for all this material.&amp;nbsp; I've a question about part of one of the VIs.&amp;nbsp; In the first image, you can see the event structure when the "exit" boolean has been pressed.&amp;nbsp; Why is there an empty false case here if the "exit" control must be true for the VI to even get as far as the case statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;I don't see any valid explanation for having the Exit Case structure inside the Exit&amp;nbsp;Button event.&amp;nbsp; If you were dealing with a button&amp;nbsp;that had perhaps a switch action, where you had the possible of a value change to&amp;nbsp;True, or a&amp;nbsp;value change to&amp;nbsp;False, then a case structure inside the event would make sense.&amp;nbsp; One other thing tha doesn't make sense in that image is that if it is an Exit event, what causes the while loop to stop?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;That image shows what I would consider a bad&amp;nbsp;practice, having an event structure inside a case structure.&amp;nbsp; The event structure&amp;nbsp;would be there capturing and queuing up events even if that case of the outer case structure never runs.&amp;nbsp; That may be unlikely to happen, but as a general rule, putting event structures inside case structures may lead to unpredictable behavior of the code.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On a more general note, I've been reading about and playing with event structures, and I'm beginning to get to grips with them.&amp;nbsp; However, what is the advantage of having an event structure with several events over having a case structure with several cases (and an empty default case if no control has changed)? The second image shows one such case statement (case for no action is displayed).&amp;nbsp; The third shows a case statement that executes on one of many controls (false case is blank), and also shows another version of that shown in the second image (case statement for this is inside the sub VI).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;An event structure could have one or more event cases.&amp;nbsp; An event case could be fired for one or more different events (such as value change on multiple controls, or mouse events, or panel close events&amp;nbsp; ...)&amp;nbsp; An event structure could have a timeout event.&amp;nbsp; Case structures are similar, you could have a default case that executes if nothing matches.&amp;nbsp; Multiple cases, or even combinational cases where a case could run in the event such as an integer is 1, 2, 4, 8..10&amp;nbsp; So you can usually come up with code that has parallels between an event structure and a case structure.&amp;nbsp; There isn't any particular advantage of one setup vs. another beyond the advantages of using an event structure to eliminate polling of controls or wire values.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whereas only one event structure is recommended (and advised) per VI, you can have several case statements working in parallel.&amp;nbsp; How can one customise an event structure to match the apparent speed of multiple parallel case statements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;You can have multiple event structures, but there usually isn't a reason to.&amp;nbsp; If you do, it is best to minimize the number, try to have any particular event only occur in one (though this isn't absolutely necessary).&amp;nbsp; Having multiple event structures, or common events between structures adds extra complication to code that could lead to unpredictable behavior of your VI if you aren't careful.&amp;nbsp;&amp;nbsp; Event structures are usually intended to just handle user interface requirements and thus only one is usually necessary.&amp;nbsp; If you need to do something where it is best to have parallel loops, then you want your event structure to handle the event quickly, then pass off any processing to one or more parallel loops by way of notifiers or queues.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And about queues... Can you have more than one queue per VI, and what else (other than event structures) can use them?&amp;nbsp; &lt;FONT color="#800080"&gt;Yes.&amp;nbsp; Anything can use queues.&lt;/FONT&gt;&amp;nbsp; What is their advantage over multiple separate controls?&amp;nbsp;&lt;FONT color="#800080"&gt; I'm not clear on what you are asking&lt;/FONT&gt;.&amp;nbsp; Do they limit parallelism and/or speed?&amp;nbsp; No.&amp;nbsp; They generally help with parallelism or increasing speed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an aside, what (if any) is the operational difference between wiring a false constant to the 'continue if true' terminal of a while loop and wiring a true constant to the 'stop if true'? &lt;FONT color="#800080"&gt;Nothing.&amp;nbsp; It is just a matter of boolean logic.&amp;nbsp; Whether it is more logical to stop if something is true (such as an error or a&amp;nbsp;value is out of range), or continue if something is true (such as a value is in range.)&amp;nbsp; If you ever find the need to put a Not! function on the boolean wire going into the terminal, then it is probably more logical to swap the state of the termina rather than adding the extra boolean logic.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologize for all these questions (some of which must seem rather obvious).&amp;nbsp; I have and am scanning help sections and forum entries etc, but I'm not quite finding answers to everything.&amp;nbsp; All replies are greatly appreciated. &lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2009 03:27:09 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/901989#M406773</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2009-05-06T03:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/902226#M406868</link>
      <description>&lt;P&gt;&lt;SPAN style="font-weight: bold" class="noindex"&gt;Why is there an empty false case here if the "exit" control must be true for the VI to even get as far as the case statement?&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;SPAN style="font-weight: bold"&gt;exit&lt;/SPAN&gt; control does not need to be TRUE to get to the case statement, it merely needs to change value.&amp;nbsp; The empty case is to avoid problems which could occur if the button were pressed before running.&amp;nbsp; While in the development environment, you can set any state for the button.&amp;nbsp; The latching action is only enforced at run-time.&amp;nbsp; This is a fairly low use case.&amp;nbsp; The extra case structure is also a fail-safe in the event the mechanical action of the button changes in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: bold" class="noindex"&gt;&lt;FONT color="#800080"&gt;That image shows what I would consider a bad&amp;nbsp;practice, having an event structure inside a case structure.&lt;/FONT&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I must partially disagree with my esteemed colleague on this one.&amp;nbsp; The event structure is part of a synchronous, event-driven task handler.&amp;nbsp; I consider this a core design pattern and use it in most of my GUI driven applications.&amp;nbsp; All events will be executed in the order they are received.&amp;nbsp; They can also be easily modified and discarded, something not always easy using a bare event structure.&amp;nbsp; Most time is spent at the event structure waiting on an event.&amp;nbsp; You can achieve an asynchronous task handler by placing the queue driven task handler in a separate loop from the event loop.&amp;nbsp; You can have both in the same application by using two or more queues.&amp;nbsp; This is fairly common, since you often want some events to be synchronous and some asynchronous. &lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2009 12:35:56 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/902226#M406868</guid>
      <dc:creator>DFGray</dc:creator>
      <dc:date>2009-05-06T12:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/902242#M406874</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;DFGray wrote: &lt;BR /&gt;&lt;P&gt;&lt;SPAN style="font-weight: bold" class="noindex"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: bold" class="noindex"&gt;&lt;FONT color="#800080"&gt;That image shows what I would consider a bad&amp;nbsp;practice, having an event structure inside a case structure.&lt;/FONT&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I must partially disagree with my esteemed colleague on this one.&amp;nbsp; The event structure is part of a synchronous, event-driven task handler.&amp;nbsp; I consider this a core design pattern and use it in most of my GUI driven applications.&amp;nbsp; &lt;STRONG&gt;All events will be executed in the order they are received.&lt;/STRONG&gt;&amp;nbsp; They can also be easily modified and discarded, something not always easy using a bare event structure.&amp;nbsp; Most time is spent at the event structure waiting on an event.&amp;nbsp; You can achieve an asynchronous task handler by placing the queue driven task handler in a separate loop from the event loop.&amp;nbsp; You can have both in the same application by using two or more queues.&amp;nbsp; This is fairly common, since you often want some events to be synchronous and some asynchronous. &lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;My coffee is still trying to displace the effects of head-cold medicine but you have me wondering...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I have an app that runs in two modes ... Set-up and&amp;nbsp; Run and I decide to code all of the Set-up stuff in one event structure and all of the Run stuff in another.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's also assume that I have made sure none of the events are set to NOT&amp;nbsp;"Lock FP".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could put the two event structures in two different cases of a case structure and everything would run fine UNLESS there is a common event for both event structures. THe event structre for the mode we are opperating in would get fired but the ones for the non-executing events structure would just pile up.... YES?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so we have a memory leak (using the term loosly here).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rather than use two static event strutures I have been using dynamic events so that only events that are servicable in the current state of the app are active at any time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Confession Time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Back in the early days of LV 7.0 I coded up an app using the State Diagram Editor where I had multiple events structures used for the differents states. I had to bend over backwards to flush queued up events that occured earlier (compared time now to to time of event) or to disable/enable controls to prevent events that I was not ready for yet in the code. I did not like the&amp;nbsp;app in the end and have avoided that since.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Clarification:&lt;/P&gt;&lt;P&gt;I am not saying that multiple events structures is bad. What I am saying is that if an event is registered it should be allowed to execute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still waking up,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2009 12:56:48 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/902242#M406874</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2009-05-06T12:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/902736#M407040</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;DFGray wrote: &lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I must partially disagree with my esteemed colleague on this one.&amp;nbsp; &lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I must thank you for regarding me so highly.&amp;nbsp; I consider that quite an honor coming from someone such as yourself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think Ben did an excellent job discussing some of the thoughts I had in mind as to the problems that could occur by having an event structure in a piece of code that is not always guaranteed to execute.&amp;nbsp; That it would be collecting events even while the case is not in the line of execution.&amp;nbsp; By the time the case would execute again, the events that have queued up might be stale, that the event might no longer have any meaning in the current state of the program.&amp;nbsp; Even if you go about just discarding the event at that point, it would be hard to distinguish between the old, stale, meaningless events, and any newer, valid events that may need to be processed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, let's say you have queued a handful of events such as different button presses over a period of time and the case becomes active again, it is very possible that handling that event or other happenings in the code cause the state of the state machine to change again and only one event gets handled.&amp;nbsp; The other queued up events would remain in the queue for a while longer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not that having an event structure inside a case structure can't work, but it would add a level of complication that I think most users of LabVIEW couldn't event anticipate.&amp;nbsp; I'm sure you would know about it and be able to work around it.&amp;nbsp; But hearing that someone as experienced as Ben ran into problems, causes me to shy away from doing something like that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I would tend to do what you had suggested where the event structure is separate.&amp;nbsp; Depending on the event and the current state of the overall state machine of the program, it would execute what needed to be done within the event case if peeking at the state showed it was valid (such as enabling/disabling controls, anthing that could be done in no more than a few seconds), discard the event if peeking at the state showed it should be an invalid action, or queue up the event into one or more queues as necessary to be sent off to whatever parallel consumer loops need to know about the event to be able to handle the event&amp;nbsp; asynchronously.&amp;nbsp; And if it is&amp;nbsp;a critical event (such as shut down any data processing,&amp;nbsp;flush the queue, and stop the consumer loop to shutdown everything), I would even place it at the front of the queue so the consumer loop handles it next in case there is still a long queue still to be processed in that loop.&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2009 00:56:06 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/902736#M407040</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2009-05-07T00:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/903109#M407180</link>
      <description>&lt;P&gt;I actually found that the synchronous task handler with embedded event structure gives me more predictable behavior than putting an asynchronous task handler in another loop.&amp;nbsp; I tried (and shipped) both when the event structure first appeared in LabVIEW 6.1, but the asynchronous pattern caused me a lot more grief than the synchronous, so I do not use the asynchronous pattern much any more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not a fan of multiple event structures in the same VI.&amp;nbsp; I understand that if you use dynamically registered events or different events in each one that it can work.&amp;nbsp; However, it adds a layer of complexity I have never needed.&amp;nbsp; For the different operating states example Ben suggested, I prefer to put case statements with cases for each state in either the event or the handling code.&amp;nbsp; I realize this can run to a lot of case statements (I have had code with near 100 events registered).&amp;nbsp; However, it also does not need dynamic event allocation or event flushing mechanisms. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Most of this boils down to programming preferences, as well.&amp;nbsp; All of the patterns we have discussed are valid, working, methods.&amp;nbsp; It really depends on what you are comfortable with.&amp;nbsp; We all have our preferred patterns. &lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://forums.ni.com/i/smilies/16x16_smiley-tongue.gif" alt="Smiley Tongue" title="Smiley Tongue" /&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2009 13:59:34 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/903109#M407180</guid>
      <dc:creator>DFGray</dc:creator>
      <dc:date>2009-05-07T13:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906817#M408626</link>
      <description>&lt;P&gt;Wow - page 13, i found this on!&amp;nbsp; Anyway, i have aother question now.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some controls being updated by local variables at the moment.&amp;nbsp; I also have some event structure events which execute when the values of some of these controls change.&amp;nbsp; How can i get these events to only execute when the control values are changed manually and not when they're changed by the local variables? &lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2009 16:19:47 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906817#M408626</guid>
      <dc:creator>J.Mamakos</dc:creator>
      <dc:date>2009-05-13T16:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906846#M408640</link>
      <description>&lt;P&gt;Prorperty &amp;gt;&amp;gt;&amp;gt; Value will not trigger an event&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Property &amp;gt;&amp;gt;&amp;gt; Value (signalling) will trigger an event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2009 17:00:12 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906846#M408640</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2009-05-13T17:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906856#M408642</link>
      <description>&lt;P&gt;So's that mean I should be using a 'value' property node instead of a local variable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry if it seems simple - my brains not working too well today!&amp;nbsp;&lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://forums.ni.com/i/smilies/16x16_smiley-sad.gif" alt="Smiley Sad" title="Smiley Sad" /&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2009 17:07:07 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906856#M408642</guid>
      <dc:creator>J.Mamakos</dc:creator>
      <dc:date>2009-05-13T17:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906871#M408650</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;James Mamakos wrote: &lt;BR /&gt;&lt;P&gt;Wow - page 13, i found this on!&amp;nbsp; Anyway, i have aother question now.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some controls being updated by local variables at the moment.&amp;nbsp; I also have some event structure events which execute when the values of some of these controls change.&amp;nbsp; How can i get these events to only execute when the control values are changed manually and not when they're changed by the local variables? &lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt; I'm known as the "anti-Local" guy of the forum...&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you are using Event Structures, within a While Loop (note that I have not seen your code, just reading this thread), and using (can use?) shift registers, then you do not need Local Variables.&amp;nbsp; Using an Event Structure will only execute when the event setting (usually value change upon releasing a button) is detected (occurs). &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not seen what the code is supposed to do when the operator triggers an event (ie: push/release a button).&amp;nbsp; One solution is to use Event Structures with either a Queue (data) or Token which typically causes a State Machine within another loop to proceed with whatever actions need to occur as per the event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope I didn't confuse you too much &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My brain is still trying to adapt to lack of sleep and a little bit of jet-lag..&amp;nbsp; without the use of cafeine... &lt;span class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;😮&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;R &lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2009 17:19:50 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906871#M408650</guid>
      <dc:creator>Ray.R</dc:creator>
      <dc:date>2009-05-13T17:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906877#M408654</link>
      <description>&lt;P&gt;I've got my shift registers all wired up too, don't worry. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The controls i'm talking about are numeric controls which can be changed either manually or programatically.&amp;nbsp; I want their value (on the FP) to update every time they're changed, but for the event structure to only execute when the user types a new value or uses the little arrows to the side of the control to increase or decrease the value.&amp;nbsp; I do not want it to execute if the value has been updated programatically because of something happening elsewhere in the code (for example being updated by a local variable, or property node). &lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by James Mamakos on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 05-13-2009&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 06:26 PM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 13 May 2009 17:26:05 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906877#M408654</guid>
      <dc:creator>J.Mamakos</dc:creator>
      <dc:date>2009-05-13T17:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906921#M408678</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;James Mamakos wrote: &lt;BR /&gt;&lt;P&gt;So's that mean I should be using a 'value' property node instead of a local variable? &lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Don't make assumptions about things that are not written down!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; (Ben did not mention local variables!).&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Change via &lt;U&gt;local variable&lt;/U&gt;: does &lt;STRONG&gt;not&lt;/STRONG&gt; trigger a value change event&lt;/LI&gt;&lt;LI&gt;Change via &lt;U&gt;value property node&lt;/U&gt;: does &lt;STRONG&gt;not&lt;/STRONG&gt; trigger a value change event&lt;/LI&gt;&lt;LI&gt;Change via a &lt;U&gt;signaling value property node&lt;/U&gt;: &lt;STRONG&gt;will trigger&lt;/STRONG&gt; a value change event (unconditionally, even if the old and new values are the same!)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;If you don't want to trigger an event, you have a choice between 1&amp;amp;2 and 1 (local variable)&amp;nbsp;is strongly preferred in most cases.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2009 18:23:16 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906921#M408678</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2009-05-13T18:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906955#M408695</link>
      <description>&lt;P&gt;btw: I like the title of this thread.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is a &lt;STRONG&gt;crash course in programming&lt;/STRONG&gt; similar to the &lt;STRONG&gt;blowout sale at the tire center&lt;/STRONG&gt;? &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2009 18:58:37 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/906955#M408695</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2009-05-13T18:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Crash course in Event Structures</title>
      <link>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/907497#M408908</link>
      <description>RAY , I lost your email , what is it again ?&amp;nbsp;could you please&amp;nbsp;send me a reply to any of my emails !! Thank you</description>
      <pubDate>Thu, 14 May 2009 13:16:36 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Crash-course-in-Event-Structures/m-p/907497#M408908</guid>
      <dc:creator>kmous</dc:creator>
      <dc:date>2009-05-14T13:16:36Z</dc:date>
    </item>
  </channel>
</rss>

