Using multiple events structure inside state machine to control the Tab

Hi y'all,
Anne here.I have a Tab indicator in my front panel and I want to be able to control the flow of my program based on what controls I clicked inside the tab. I am using a state machine architecture and inside every state, I use an event structure to check for user interaction  to determine the next state and what tab page is going to be displayed next. This means that I am actually using multiple event structures in my application and I use them in just one while loop, but just that they are not running in parallel since I am only using "one event structure per state" which means that only one event structure is running at one time. My questions is, programming technique wise, am I doing it correctly? So far, I am not facing any problem (I am still in the early stage of the project) but I want to check with you all first on your opinion regarding this architecture. Will there be any issue on using multiple event structures in a vi? Since I will be using a tab, and the controls available in the tab will be the controls that will control my event structure for that state, by right, there should be no issue. Am I correct to assume this? Is there any limit on the use of event structures? I have attached here a simple sample of the architecture that I am talking about for your reference. I have attached a 2010 version and a 8.6 version. Let me know what you think or any opinions that you may have.
Hoping to hear from you soon! Thanks so much in advance!
Cheers!
Anne
Attachments:
State Machine-Event Structure Sample_2010.vi ‏19 KB
State Machine-Event Structure Sample_8.5.vi ‏25 KB

Hi jak888,
I decided to use tabs cause I don't want to have subvi pop ups every time i need to perform the process in the state and show an update in the front panel. This is actually going to be more of an ATE where you will have to choose first whether the one using is the operator or the engineer. If the operator is logged in, she will proceed to choose what test to run (this state will have its own event structure). This part, I don't want a pop up, so what happens is that from Login page, if the user logs in as operator, the tab will automatically switch to the Test Selection page. After selecting the test, it will proceed to Start Test state and the tab will show the Result Summary page. If the user logs in as engineer, then a totally different tab will be automatically shown next and so on. By doing this, I will be able to show an update on the front panel objects without having the subvis pop up. I will also just need to use the call reference functions to call my subvis, making my Main VI more generic. The tab Page header will be hidden so the operator will actually not see that there is a tab and that there are a lot of controls and indicators cause they are hidden in the tabs and that page will only be shown based on what they selected from the main tab. 
I appreciate your thoughts! thanks so much!

Similar Messages

  • Using an event structure to reset a boolean control with ring menu value change

    I am trying to get two boolean buttons to reset when the value of a ring menu changes.  For this I am using an event structure set to execute with a ring value change.  However I have other code that needs to be executing while the event structure waits for the value change.  I place my event structure inside the while loop the buttons reset as expected but my other code does not run (except at the moment of value change). If I place it outside the loop the rest of the code functions as expected but the buttons do not reset.  Any help you can offer is much appreciated.
    Solved!
    Go to Solution.
    Attachments:
    event structure reset.vi ‏11 KB

    try this
    Attachments:
    event structure reset_edit.vi ‏14 KB

  • How to use an Event Structure responding to an image control that belongs to a parent VI.

    Hi
    I am loading a subpanel vi by pressing a button located in the user interface of the main vi which also contains an image display. Subpanel vi opens up on the side and doesn't hide the image display of the main vi. Subpanel vi contains an event structure that needs to respond to user clicking on the image display of main vi.
    Since the bug that occured while creating an image reference control isn't fixed, I am passing the main vi pane reference onto the subpanel vi. From that point I've tried to edit event structure and have it respond to the image control/pane that belongs to main vi but I don't know how.
    Any help would be appreciated.
    Thanks

    Post a screenshot of your subVI code where you register the events.
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Multiple event structure in a while loop

    Dear All,
                   I had a multiple event structure inside a while loop. The purpose of doing so is because I had a few 2D picture on the front panel. I would like to detect which 2D pictures had been click using the mouse down event structure for 8 of my 2D pictures.
                  The problem that I faced now is that when I of the event case or one of the 2D pictures had been click, it will not exit the while loop. I had to click on all the 8 2D pictures before it will exit the loop.
                  I had uncheck the under the "Edit Event" --> "Lock Front Panel (defer processing of user action) until this event case completes". But I am still stuck inside the loop.
                  Each 2D picture will perform different action therefore I cannot have an event case of all 2D pictures inside else I would know which 2D picture had been click.
                 Is there any other way out of this situation? Pls help. Thanks a lot

    A producer/consumer architecture (look at the examples that ship with LabVIEW) is comprised of two parallel while loops. One loop contains the event structure. The other contains your consumer which is basically a queued state machine. It receives messages from the producer via a queue. Your event structure can register a separate event for each 2D picture control or it can use a single event that would determine which spefic controls was clicked on. This is a more general approach and expands easily. Here is a basic example of what I am talking about.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot
    Attachments:
    Event Producer-Consumer.vi ‏14 KB

  • How to use a event structure in a subVI

    I am trying to use an event structure inside a subVI.  The subVI has an array builder that builds arrays, and the event structure is used so that when the program is running, it allows you to change the elements of the array.  It works, but when I implement it inside a subVI, it does not work properly.  This is going into a subVI, because it will be a part of a much larger progrram, so it needs to be modular.

    If you're using an event structure, it's not a subVI.  if you're worried about modularity, you shouldn't be using the event structure.
    You seem to have a fundamental misunderstanding of modularity.  An event structure should be placed within a while loop.  If you have a while loop within a subVI, you've handed over control of your program to the subVI.  You're not modular at this point.  Your top level GUI has no control.  You'd have to create some asinine system of variables to pass data down to that loop to stop the loop and return to your main VI.  That's not a good design decision.
    Instead of looking for a way to do something broken, you should spend effort trying to understand what you actually want to accomplish.  You should also spend some time learning how event structures work.
    This application is small right now and it's already on the path to unreadable.  That's a terrible thing to do to yourself.  Break these habits now.  se variables only when absolutely necessary.  Use subVIs to accomplish individual tasks, not run the entire application.  With event structures, use a stop button value change event to not be held hostage by the timeout.  If your variable has "2" in it, you're doing something wrong.  There has to be something different between the setpoints, put that in the name.  If you want to make subVIs, create an icon.
    But first and foremost, invest time in understanding dataflow

  • 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

  • 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 .

  • 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.

  • Acquiring continuous data using an event structure

    I am new to labview, having recently taken the Core I and II courses.
    I am programming a test rig to acquire the linear position of a hydraulic cylinder and plot it over time.  In programming this code, I elected to use an event structure so that when a front panel button is pressed, a certain part of the test is run. 
    In one particular part of the test, called the Snub Test, I need to measure the position of the cylinder over time and plot it to a graph.  The data acquisition needs to be continuous, however the event structure only allows the loop to run once. 
    I have attached a portion of my code for reference.
    Can someone please advise how I can get this data acquisition to run continuously until the user (or a reference trigger) stops the test?
    Thanks
    Attachments:
    Front Panel.vi ‏115 KB

    A few comments to your VI in general:
    You changed the stop button to "switch until released", most likely because you fabricated a race condition and did this as a quick fix. The reason is (1) your placement of the stop terminal outside the event structure and (2) the use of a local variable wired to the stop condition. The button terminal of a latch action boolean belong inside it's associated event case! This way it gets read (and reset to false) when the event occurs. In your case, the local variable and the button get read before the event occurs and the loop needs to spin once more at the event that occurs when you release it (true->false). At this point, the local is still true from the earlier event and the loop stops. Correct would be: latch action, stop terminal inside stop case and wired to the stop condition from inside the event. Other cases use the default output (false) and don't stop the loop.
    Your "equal false" code fragment is just an invert, right? So why complicate things?
    Why do you need a wait if there is an event structure?
    LabVIEW Champion . Do more with less code and in less time .

  • Using Multiple Event Listeners

    Hi,
    I have a movielcip (A) class in which I have used a Tween class effect on a child movieclip (B) scrollRect. The (B) Movieclip in turn has several movieclips whose have tween class effect being executed on thier child movieclips.
    the tweens are all unique to each movieclip
    and the event listeners are taken off once completed.
    This works all well and good in FLASH IDE...
    My problem arises when I try to view this in a browser on a Windows XP
    it doesnt work in
    Opera Version 9.63
    Firefox 2.0
    and Google Chrome 2.0
    The only browser it works fluently in is
    Internet Explorer 7.0.5
    What is happening in most cases it that the animation appears to "stick" but i think what may be happening is the listening or removal of the event listeners. The animations are left incompleted.
    Is there any rule of thumb when using multiple event listeners?
    here is a snippet of some of my code
    on click event from movieclip (A)
    private function scrollToSlidePrev(e:MouseEvent) {
                   if (((slideIndex - 1) >= 0)) {
                        nextButton.mouseEnabled = nextButton.enabled = previousButton.enabled = previousButton.mouseEnabled = false;
                        var position:Number = 0-SLIDEAREA.width;
                        var slide1:TileListSlide = slides[slideIndex] as TileListSlide;
                        var slide2:TileListSlide = slides[--slideIndex] as TileListSlide;
                        scrollSlide(position,slide1,slide2);
    tween animation in movieclip (A) on (B)
    private function scrollSlide(pos:int,slide1:TileListSlide,slide2:TileListSlide) {
                   slide1.resizeSlideTo(0.6); // execute tween on child movie clips in B
                   slide2.resizeSlideTo(1); // same as above;
                   var rect:Rectangle = sliderMc.scrollRect;
                   var tween1:Tween = new Tween(rect,"x",Regular.easeOut,rect.x,rect.x + pos,3,true);
                   tween1.addEventListener(TweenEvent.MOTION_CHANGE,setSliderScroll,false,4);
                   tween1.addEventListener(TweenEvent.MOTION_FINISH,toggleButtonEnabled,false,3);
    tween animation in movieclip (B) children
    public function resizeSlideTo(sc) {
                   var m:Matrix = tileList.transform.matrix as Matrix;
                   var p:Point = new Point (m.a, 0);
                   var tween2:Tween = new Tween(p,"x",Regular.easeOut,p.x,sc,3,true);
                   if (numericStepper != null) {
                        if (sc != 1) {
                             numericStepper.visible = false;
                             tween2.removeEventListener(TweenEvent.MOTION_FINISH,showStepper);
                        if (sc === 1) {
                             tween2.addEventListener(TweenEvent.MOTION_FINISH,showStepper,false,2);
                   tween2.addEventListener(TweenEvent.MOTION_CHANGE,setScaleOnScroll,false,3);
    here is the link
    http://visual_admin.web.aplus.net/ticker/ticker_widget.html
    the effect disables and re-enables the buttons when its done.... then the listeners are removed.
    each one with the exception cretes its own unique tween (obviously this is a custom class built as each clip)
    i really don't know what to make of it guys         

    apparantly making the tween a property of the class rather than a random variable in a function worked.....go figure

  • Can I use an event structure within another event structure

    Hi
    Can use an event structure within another event structure?
    Thanks
    Yasamin
    Solved!
    Go to Solution.

    I attached my Vi from my old project (MY OLD VI). It is worked correctly.
    But I decided that use event structure instead of case structure.
    I attached my new VI as a picture and as a LabVIEW VI too (network_analyzer_8510_920527 Frequency Sweep.vi )
    My graphs show by pressing "case 5: button (Bottom of page right hand).
    Then I want to show each of graph in a large window( in a new VI) by clicking a key (for example "show 1").
    Thanks
    Yasamin
    Attachments:
    my VI.JPG ‏256 KB
    network_analyzer_8510_920527 Frequency Sweep.vi ‏72 KB
    MY OLD VI.vi ‏69 KB

  • Coverage Strategy use multiple Category Structures

    Hi AFS Expert,
    In the same Coverage Strategy, does it allow to use multiple Category Structures to do the transfer from requirement category to stock category?
    E.g Category Structure: AA, BB
    "Category Structure AA --> Coverage Strategy CS1 --> Requirement category" transfer to "Category Structure BB --> Coverage Strategy CS1 --> Stock category"
    Is it possible to do?
    Looking forward your kind advise.
    Thanks,
    Mag

    Hello Mag,
    The coverage strategy is configured for a single category structure and it maps the category values of that category structure. We can define the sequence in which the stock categories map the requirement categories. We will not be able to map the requirement category to stock category across category structures.
    Hope this information helps.
    Regards
    Sudha
    >
    Mag Sai wrote:
    > Hi AFS Expert,
    >
    > In the same Coverage Strategy, does it allow to use multiple Category Structures to do the transfer from requirement category to stock category?
    >
    > E.g Category Structure: AA, BB
    >
    > "Category Structure AA --> Coverage Strategy CS1 --> Requirement category" transfer to "Category Structure BB --> Coverage Strategy CS1 --> Stock category"
    >
    > Is it possible to do?
    >
    > Looking forward your kind advise.
    >
    > Thanks,
    > Mag

  • Using nested Event Structures

    Hi ,
    I wanna clarify whether using nested event structures in a vi is good Labview programming ?
    I have a vi which has two event structures nested,assuming it has two buttons GO1 and GO2.
    The outer event structure handles event triggered by GO1 and inner event structure handles Go2.
    The outer structure does fine by handling the button click on GO1,the problem is inability of inner
    event structure to handle click on GO2 button.
    I'm also attaching a sample.vi for reference.It would be great if you could help me
    solve this issue.Thanks in advance.
    Regards,
    Nalin
    Attachments:
    sample.vi ‏30 KB

    You can actually make this work, but like the others, I don't recommend it.
    To make your VI work. Right click on the "GO1" structure and select "Edit Events.....". At the bottom of the dialog, there is a checkbox that reads "Lock Front Panel until the event case for this event completes". With this checked, all front panel objects are locked until the GO1 event completes. This is what is causing the GO2 button not to work. Uncheck this and your application will work as you want it to.
    If your intent is to have GO2 disabled until you click GO1, try the attached VI. It uses property nodes to disable the GO2 button until you click the GO1.
    Another thing that you have setup that doesn't look necessary is the Timeout event, especially set to 1ms. The basic idea of the Event Structure is to not have to constantly poll for front panel events. If you just deleted the timeout event cases and removed the 1ms constant, your application would just well, but would just sit and wait for you to click a button.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    sample.vi ‏27 KB

  • How to use multiple events on one project?

    I want to make a show reel, this obviously involves using various events.
    I'm worried if I do this the whole file system will be a mess. Surely I should be sopying any files I want to use into the new showreel folder?
    How can i do this?
    Or is using various events ok?
    Hope someone ca recomend the best way forward

    You can edit from any event into the project. There is no need to copy the clips into a new event. When you're done you can archive the used clips into a new event.

  • HT201415 I want to purchase a month of cellular service for my IPAD2.  When I use my ITunes password,  it states that I have the wrong password but does not offer a way to reset my password.  Please advise.

    I want to purchase a month of cellular service for my IPAD2.  When I use my ITunes password,  it states that I have the wrong password but does not offer a way to reset my password.  Please advise.

    Read through this link and maybe you'll see something that will help you:
    http://www.tech-recipes.com/rx/5827/ipad-3g-activating-purchasing-att-cellular-d ata-for-the-ipad-3gwifi/

Maybe you are looking for