Is it better to have one Event Structure with more (10 or 15) cases or several with fewer?

I have several buttons and events on the GUI of my app to monitor. Would it be better to use one Event Structure with several cases (10 or 15) or have a couple and split the cases evenly? None of the cases have much processing to handle, so there is not a time lag issue. I am just worried about overloading the structure. One of the tech support guys mentioned that the event structures are not that hard to get confused.
Has anyone had any problems with Event Structures?

I use event structures very often in my code. I use them just to handle the interface and to run small code. I have had event structures that handled over 50 user interface events and never had a problem. In my personal opinion If there was any code to run I would let the event structure handle the the user interface event that fired a que in another while loop that handled the code.You can find examples on this, if not I will send you one. It is just good programming practice for beginners because it will alow you to build more robust VI's in the future.
Hope this helps
Joe
Joe.
"NOTHING IS EVER EASY"

Similar Messages

  • Event structure: have one event trigger another event

    I have an event structure with two events. I want the finalization of the first event to trigger the second event. Both events are triggered by a boolean value change, say "boolean 1" and "boolean 2". Can I have a local variable of boolean 2 inside event 1. By changing its value, it should trigger event 2. However, this doesn't seem to be working. (see attached example)
    any help?
    Solved!
    Go to Solution.
    Attachments:
    test.vi ‏9 KB

    Tim's reply is the answer you are looking for.
    I would like suggest that you create a sub-VI that doesw the work in the second event you want to fire so tht rather than resorting to having one event trigger another, you can simply use the sub-VI that does the work in event_2 after the sub-VI that does the work for event_1.
    If you decide to stick one event triggering another, please clearly document the sceme in BOTH events. What you want to avoid is latter deciding event_1 should be triggered by Event_2 and the next thing you know, your app hangs.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Can I have multiple event structures with the same event cases?

    Hello, 
    I'm doing an application that reproduces the front panel of the HP6675A power supply. To achieve this, I have done a state machine with different states
    (initialize, measures, voltage, current, ocp, ov, store, recall, etc). In each state, should have an event structure that catches the events of the buttons, like for example: if the current state is the Voltage mode and the user press the current button the next state will be the Current mode. For this in each state of the state machine should be the same event structure with the same events.
    My problem is that the Vi doesn't work properly when I have multiple event structures with the same event cases. There are some possibily to do this, and how? Or is impossible to have multiple events? I have been reading some posts, but I don't find solutions. 
    Any help is appreciated.
    Thank you very much.
    Solved!
    Go to Solution.

    natasftw wrote:
    Or as others mentioned, make two parallel loops.  In one loop, have your state machine.  In the other, have just the Event Handler.  Pass the events from the handler to the state machine by way of queues.
    A proper state machine will not need the second loop.  The "Wait For Event" or "Idle" state (whatever you want to call it) is all you really need in order to catch the user button presses.  The setup is almost there.  Maybe add a shift register to keep track of which state to go to in the case of a timeout on the Event Structure.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Generally, is it better to have one LONG script/applet or break up the functions?

    Let's say I'm doing processing for 5 things that are semi-related, or the same process but for many interfaces.  Should I have one script/applet that does it all or make five scripts/applets?
    Does Cisco EEM work better with multiples short sessions or one longer session?
    Thanks,
    Tim

    EEM was designed to provide short-running automations.  The default max runtime for all policies is 20 seconds.  However, this runtime can be extended to huge values.  It really depends on the specific use case as to whether it's better to do all the work in one policy, or break things up into multiple policies and chain them together.  If the policy will be doing the same thing, but on a large-ish dataset (like interfaces) it would be better to do it all in one policy versus trying to duplicate the logic in multiple policies.

  • I have one Mac, two users.  I wish to share a iBook with my wife, the other user.  I move a copy of the book folder to "public" folder, and in her account "added to library".  Does not show even though cue claims it is in her library.  No book.

    I find sharing books within my one computer near impossible - not easy as music is.  It used to be easier, but now with iBooks and some other changes this has become difficult.  Also - I can use the search feature to find the "books" folder, and use "Get Info" to find the supposed address, and then not find that folder location at all using a manual method stepping through Finder.  So a second question is:  where is this file hiding?  It is not under User/Library/Containers.... as claimed by "Get Info".  It seems that if I buy a book, the family can use it to put on their iPad.

    Part of me understands the need to have purchases protected.  I hope this does not get more and more complicated for "within family use".  It is nice to buy music and share it with my wife, as we used to do with books prior to the iBooks "upgrade" - which mostly consisted of making it impossible to share books.  Thanks though for your response;  I was hoping for some luck and that maybe I had missed some simple step.  To Apple:  lighten up.
    Best regards and thanks again for taking the time -

  • Continue with my program until the DAQ have one event (NI TB-2705)

    Hello to all,
    I am trying to do a program that contains multiple sub VI which I go calling sequentially within one loop.One of this sub VI is a DAQ subVI in which I read data of one NI TB-2705 Daq Card of my PXI system, In this subVI I want start the DAQ with the appropiate parameters, I think that I can be able to do it but I need besides continue with my program,that is continue with the loop which call the rest of my sub VI (the DAQ must to continue running too) until this data are out of one range, them I need stop the loop of my program and return to mi DAQ sub VI and storage the DATA. Is it possible???
    If someone have some example about this subject or could help me.
    Thanksfully
    Gonzalo De Francisco

    see here

  • I have Verizon FiOS service for phone, internet and TV but I only have one TV hooked up for it for just basic cable service with no DVR and no need for widgets.  Can I use an Airport Extreme as my router and not use the FiOs router?

    I want to use an Airport Extreme as my router.  I currently have a Verizon FiOS router.  I have Verizon for phone, internet and TV.  However, TV-wise, I just have a basic service for one TV with just a regular box.  No HD, no DVR.  Don't need access to a menu, widgets, on-demand.  Can I eliminate the FiOS Router and just use the Airport Extreme and still have phone and internet?

    I know that it will increase my wireless coverage in my house but will it increase the speeds?
    Not sure what you are asking here.  The AirPort Extreme is only going to be as fast as the Internet connection that it receives.....which is 75/75. It cannot take a 75/75 connection and make it go any faster.
    If you locate the AirPort Extreme in an area where you need more wireless signal coverage, the AirPort Extreme would deliver 75/75 in that area.  But, keep in mind that the AirPort Extreme must connect to the FIOS router using a permanent, wired Ethernet cable connection.
    If you are asking if the AirPort Extreme can wirelessly connect to the FIOS modem router, and extend the FIOS wireless network, the AirPort Extreme would not be compatible with a FIOS product for that purpose.

  • I have one of my pages documents which is shown in the list with a loading bar but not loading, I even cannot delete it, what can I do with this?

    I have same effect on my (new) iPad and my iPhone.
    It looks like the doc is loading, but no progress at all...
    All other docs are fine.
    Any ideas?

    The people responding in this forum are just other Apple product users like you, not Apple itself.  Apple Support Communities is primarily an end-user to end-user (i.e., users like you helping other users) technical issue support feature.
    Try:
    Contact Us

  • Multiple event structures in one program

    I know it's not good practice to have one event structure inside another event structure (I don't know exactly why). But if another event structure is in the subvi, is it safe? Please comment.

    guangdew1 wrote:
    I know it's not good practice to have one event structure inside another event structure (I don't know exactly why).
    This is because of dataflow and the way event structures work. If you have an event structure inside an event structure, both event structures will accumulate events whenever one occurs, but it is unlikely that they can be handled in the order they occur or at all. By default, event structure are set to lock the front panel until the event completes, meaning that if an inner event gets triggered first, the code will lock up, because it will no longer be possible to trigger one of the outer events. If the outer event occurs first, it cannot complete, because it requires a later firing of one of the inner events before it is ready to handle the next event that occurs in the UI. Even if it marginally works if the panels don't get locked, you are requiring the user to trigger events in a certain order. How is he supposed to know what's allowed or not?
    If this is not exactly clear to you, you need to start with a few tutorial and learn about dataflow, Then start using a single event structure and see how things work by programming scenarios and see what happens.
    guangdew1 wrote:
    But if another event structure is in the subvi, is it safe? Please comment.
    Event structures are only useful inside interactive subVIs that show their front panel. even then I strongly advise against calling anything interactive, or anything that takes excessively long, inside a main event structure. You end up with code that can become unpredictable, can deadlock, is hard to debug and flies in the face of all good programming guidelines.
    Obviously, you have some specific application in mind where you think something like that is useful, I can guarantee you that there is a much better solution is you think about this a bit longer. If you need help, please describe exactly what the program should do and how it should react to user interactions at the various stages.
    A program should always be approached from the code and UI needs. Don't start with a harebrained code construct (events inside events) and then look for a use. It does not exist! 
    Event structure only belong in toplevel loops. They should never be hidden insde squences or case structures (or other event structures as already mentioned above). If you have multiple toplevel loops that run in parallel, it is safe to place up to one event structure inside each. Each event structure can have an unlimited number of event cases. This should be sufficient to handle any programming need you might have.
    LabVIEW Champion . Do more with less code and in less time .

  • Combine event structures

    hello,
    I'm having to combine several labview programs together, and some of these programs have event structures with a bunch of cases, is there any programmatic way to combine two event structures?  My finished code will only have one event structure which will be the result of all the other programs event cases combined, I'm trying to avoid having to type all these out
    much thanks!

    Unfortunately no. You can't combine event structures. The best you can do is take advantage of the opportunity to rework the logic and maybe improve it.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Multiple event structures in one VI

    I have two event structures in a single VI, one that handles events that freeze the user interface and one for events that don't. The latter group are all triggered acquisition tasks, where you arm the  data acquisition, but possibly might want to abort it (or do other things, while waiting for the data to come. Obviously you need a stop button to be active and responsive. In retrospect, using two loops was possibly a poor choice, but one I made because it never occured to me that these things would only fire once and have to be put in a while loop to be kept active. No other language does that as far as I know. Anyway, the question is how do I keep both active? Do I enclose both in a single while loop? Do I give each there own while loop. Do I give up and merge the two event structures into one. For clarity I would like to keep them seperate, but that is not essential. I'ld like to know what my options are.
    Solved!
    Go to Solution.

    rossu wrote:
    If they are in sperate while loops will they both run. If they are in one loop will the loop recycle if one structue is still waiting for an event to occur?
    The answer to this is fundamental to how LabVIEW works. A loop will not proceed to the next cycle until everything inside it completes. If you have two event structures in the same loop, both of them need to process an event (or a timeout) before the loop will iterate.
    You can have multiple event structures in the same VI.
    By "freeze the UI," do you mean the "Lock front panel..." checkbox in the event dialog? There is no problem with having some events that do lock the front panel and some that do not in the same event structure. I'm not sure that this is what you mean by "freezing" the UI, though.
    EDIT: and one more comment. Generally you should not put long-running tasks (like data acquisition) inside an event structure. Instead, the event case should pass those tasks off to a separate loop (for example using a queue) so that the event structure can quickly go back to listening for other events.

  • Can you share FP Controls between different Event Structures

    I'm creating a program that will either read real-time data from an VNA on the GPIB bus, or read a saved s2p (Agilent) file and analyze it. The FP consists of 5 graphs, and various controls which handle events like printing, changing filters, or exiting. on the BD I have a case structure controlled by an operator selection pop-up. I tried using the same FP controls in the event structures I have setup in each case, as only one event structure would ever be executing at any given time, but the program doesn't seem to like it ast run-time. I've worked around the issue by creating "duplicate" controls and using the property setting to make them visible/disabled, etc., but the is seriously congesting my BD.
    Anyone know a way to share controls with seperate event structures?

    It sounds like the root problem is the overall structure of your program. I highly recommend that you check out the Queued Message Handler project template in LabVIEW 2012, that will show you how to utilize a single event structure and pass events to a consumer loop. If you program is too large to consider an architecture change at this stage of the game, then there is a workaround for your problem.
    What is most likely happening is that you have the event structures all set to lock the front panel until the event completes. However the case structure that you have wrapped around these event structures is causing all but one of these event structures to be unreachable thus preventing you from handling the event. Again, as I stated above, the "RIGHT WAY" to fix this is to select a better program structure but the "kluge work-around" fix is this: Dynamically register for the value change event on all of the controls you are trying to trap events for. Dynamic events can be deregistered and re-registered at run time. This will allow only the event structure in the active owning case structure to be registered for the events, thus no other event structures will get in your way.
    Disclaimer: This advice is given based on very minimal information and a great deal of speculation and may not be correct. Please include your code if you need further assistance.
    Charles Chickering
    Architecture is art with rules.
    ...and the rules are more like guidelines

  • How to determine the execution order of event structure

    Hi everyone,
    I have an event structure were it contains four events. All the four events has separate buttons to execute. Here, three events will generate numeric output, remaining one event (Finder) should find the order of those three events. For example, Three events namely A, B and C. I execute the events in the order of B, C and A. The finder event should find the order of previously executed events(B, C and A). 
    Thanks in advance.
    Solved!
    Go to Solution.

    Hello Vij@y,
    I could not look in to your VI because I dont have LabVIEW 2013 (I have 2010) but i tried to understand the situation you are explaining.
    Please find attached image of front panel I made for your reference.
    Here I generated two events sequently, no 3 first followed by no 1 and the same is displayed in sequence array. now you can use the build array function to actually add each event to this array as explained by many people in this forum.
    regarding the timeout event, either you can display the sequencer array in that event or you can display it in finder event and then you can reset the sequencer in finder event (I used reset button click event to reset sequencer back to zero value)
    regarding getting zero when you press finder/reset button before triggring any other event:- Is it not correct to have empty array when you have not trigger any event?
    I hope I put it well and may help you to find solution. 
    With Regards
    Miraz
    Kudos is better option to thank somebody on this forum
    Attachments:
    Sequence.png ‏70 KB

  • Daqmx "Done" event not triggering event structure

    I would like the user to be able to abort my daqmx task by pressing a button.
    I am attempting to use the method in this VI:
    https://decibel.ni.com/content/docs/DOC-15815
    It utilizes an event structure with the daqmx Control Task VI to abort.
    The example VI above works for me, on my system with my USB-6356 device, as expected.
    When I attempt to incorporate the same method into my VI it does not--despite having an identical arrangement, so far as I can tell.
    I believe that my problem lies with the event structure, and the dynamic registration.  I am unfamiliar with this and must be using it incorrectly.
    I have attached my VI, though it is cumbersome.  The code which I am struggling with is in the "Acquire" case.  As far as I can tell, I am doing exactly the same this in this particular case as in the example mentioned.  Yet in the example, the event structure completes, or aborts, whatever you want to call it, right after the "Wait Until Done" VI executes.  In my own VI, the "Wait Until Done" and "Clear Task" VIs execute, but the event structure does not register it.
    Here are my specific questions: is there anything extra or special that one must do in order for the Task to properly trigger a "Done" event and pass through the event structure?  At what point is the daqmx task "Done"? 
    thanks,
    Matt
    Attachments:
    BoomTubeMain.vi ‏175 KB

    natasftw,
    My event structure is identical to theirs; what you are seeing are the two different cases that exist in the event structure.  In both the example and the VI, there is a <task out>: Done and a "Dynamic Event": Value Change.  In the dynamic event case, I have my abort button and relevant code--this I believe is the code you were referring to, which you thought I was missing...  Regarding my multiple event structures, they should operate completely independently as they respond to different events.

  • Can I get the event structure to NOT queue events?

    I was wondering if it is possible to have the event structure not queue events that happen while the vi is executing code associated with another event. Basically, I have a toggle switch that, when "on", captures a live feed from a camera and displays it to the screen. This is done in a while loop that executes until the toggle switch is turned off. At this point, that event is done and the vi returns to the uppermost level of the event structure and resumes looking for events. The trouble is that the whole while the video capture was happening, the event structure was queueing events that were occuring during that time when the user was hitting other front panel buttons that had their own event associated with th
    em and would not execute at that time. When the video capture toggle is turned off the event structure then executes any other events that were queued during that time and I don't want it to. I can't lock the front panel while the video capture is happening so the user can't push buttons because they have to be able to push the button to turn the video capture off. Any suggestions? Thanks in advance.

    > I was wondering if it is possible to have the event structure not
    > queue events that happen while the vi is executing code associated
    > with another event. Basically, I have a toggle switch that, when
    > "on", captures a live feed from a camera and displays it to the
    > screen.
    I think there are lots of other articles about this on devzone.
    To summarize them, the key is that the event structure intentionally
    synchronizes events with diagram execution. The typical way to do what
    you want is to have the event start up another loop or subVI running
    asynchronously.
    Usually there ends up being one loop with an event structure in it.
    Another loop that executes a statemachine, possibly as simple as just
    two states of acquiring and not. Use the events to pr
    od the other loop
    between states via locals, globals, occurrences, etc.
    Greg McKaskle

Maybe you are looking for