Unexpected event structure behavior

Attached is a snippet (2009) that is not behaving as I expect. You can try to type in an entry in the control that isn't in the pull-down, then click out. There will be no visible entry in the control, but the event structure runs anyway. Is this expected? I had to add code to a VI to account for the event case running even though there was no entry in the control.
Solved!
Go to Solution.
Attachments:
unexpected behavior.png ‏30 KB

Apologies in advance, I do not have LV here to test, but based on reading the replies I feel like something is missing here.
With the Combo Box, clicking outside the control is like hitting enter, the check mark button, etc.  It will fire the Value Change Event even if the value is the same.  This is true for all controls.  It is more of a Value Entered event.  Pressing Escape is the proper method to cancel the entry.
If you enter an invalid string by clicking as described, the value will be empty and the Value Change event should fire.  This should be reflected in NewVal="".  OldVal *should* be correct, is it not?  Doing it twice should give you OldVal=NewVal="", but not the first time.  I am almost certain I would have seen this bug if it actually exists.
In short, I expect that entering an invalid string will fire the Value Changed event.  I do not expect OldVal to equal NewVal unless an invalid entry (or the same valid entry) was entered twice.  Does it really on the first try with an invalid entry (valid followed by invalid)?  I say check for NewVal="" and if so either complain to the user or write OldVal to the ComboBox Value property or local variable. 

Similar Messages

  • Are user events valid before the event structure executes?

    If I create and register for a user event and immediately generate that event before my event structure has seen the registration refnum, is the event still guaranteed to be seen by the structure? That is, are events queued up? It works but I am wondering if I can rely on it. I am very sure that I can but I am creating some production code and want to be assured that I am not just taking advantage of a bug.
    A picture is worth a thousand words.
    =====================
    LabVIEW 2012
    Solved!
    Go to Solution.

    Generally, Felix's explanation is correct and the queue exists from the moment the register node executes, so the answer is that you can rely on this.
    You should, however, be aware that when playing with dynamic registration you can experience some unexpected side effects, as you can see, for example, in this LAVA thread - http://lavag.org/topic/13607-dynamic-event-reregistration/
    Another example would be this - http://lavag.org/topic/13970-unexpected-event-structure-non-timeout-behavior/page__view__findpost__p...
    Or what happens if you split the registration refnum to more than one event structure (hint - NEVER do that).
    Try to take over the world!

  • Unexpected effect of Lock Front Panel in Event Structure

    I have been using LV intensely for only a short time, although I have dabbled with it many times since its first appearance. The "problem" that I have had may well be the intended behaviour, but it just seems unintuitive to me. I'm writing a small application to take measurements from a USB instrument. I have already written a basic driver for the instrument, which the application calls, and the driver is working as expected. In the application, the user can configure various settings and then click an Execute button to transfer them to the instrument. The click event is handled in an event structure along with other events. Since some of the instrument operations take an appreciable time, the first action that occurs in the click event case is to disable the Execute button using a property node so that further clicks are ignored until the operation completes, at which time the button is re-enabled.
    When disabled, the Execute button is grayed out as expected and clicking it has no visual effect. However, it seems that clicks made during the disabled period are still queued and acted upon when the button is re-enabled, causing the operation to be repeated.
    It is the solution I have found that seems unintuitive to me. The Lock Front Panel check box was checked (by default) for the click event, and I assumed that this would be the correct setting. However, unchecking the Lock check box actually makes everything worked as expected. Click events occurring during the disabled period are now ignored or discarded. I'm not suggesting that this is a bug, but I'm interested to learn why it happens, if anyone can explain. I have attached a picture of a simplified version of the event case.
    Attachments:
    Sample.png ‏7 KB

    I would say what you see is expected behavior, even though it's a bit complicated.
    The "Lock front panel until the event case for this event completes" option will only defer clicks and other things generating events until the current event handler completes. So this means that the click is placed in a queue and only evaluated once the event is finished. At this time, the button is no longer disabled, so an event is generated.
    When the "Lock front panel until the event case for this event completes" is not checked, the click is immediately evaluated, but it's happening on a disabled control, so it does not generate an event.
    From the LV help:
    By default, when an event enters a queue, LabVIEW locks the front panel that contains the object that generated that event. LabVIEW keeps the front panel locked until all Event structures finish handling the event. While the front panel is locked, LabVIEW does not process front panel activity but places those interactions in a buffer and handles them when the front panel is unlocked.
    Note If an event case that locks the front panel takes a significant amount of time to execute, consider using the Set Busy function or displaying a dialog box to notify the user that the front panel is locked.

  • Imitate boolean switch behavior using an event structure on a front panel indicator

    Hi,
    I am looking for a possibility to imitate the bevhavior of a boolean switch with an event structure. To be more precise, I want a boolean value to change each time I click on the front panel indicator and then remain constant until I click again. I have not worked with shift registers in a while loop yet, but could this be a way to find a solution?

    LordSnow wrote:
    Okay, I figured it out, BUT I still have a problem. Before I first trigger a mouse event on the front panel indicator, I already need the case structure to be executed once. Therefore I assume that I need some kind of default value, but since the event structure does not create any output at first, I have no idea how to do that.
    Are you talking about the shift register you just created?  You can while in a default value on the left shift register ndoe.  It is wired outside of the loop.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Some frontpanel controls stop firing the Event Structure

    In my main vi,I have an event structure. I created a subVI that also has an event structure. I load the subvi via a subpanel in my main vi. It runs fine for a while. But sometimes after firing events on the subpanel, most but Not All controls on the main VI stop firing the Main Vi's event structure. The Subpanel's subvi event structure always works fine. When I reload the program it works fine again for a while.

    This is the problem that's been bothering me too (big time actually). Thanks for the insight!
    First of all I love the event structure and it totally changed the way I program labview. Together with the subpanel addition, it makes for very professional looking programs. Here's my version of the same problem:
    I have an event structure on the main VI, and ~20 subpanels. I load various subvi's in the subpanel of the main VI as required. Each subvi has an event structure to handle GUI and incoming user events. I found the problem in the full blown operation, but the problem also appears when I only have one subpanel running, so only one event structure in a subpanel and one event structure in the main program.
    I had the problem with a mouse down on a table, and with a doubleclick on a listbox. And indeed I had an attribute node (reference + property node in my case) to the listbox in the event case that handles the doubleclick. When removing the attribute node, no more buttons will stop to respond on the main panel. When you try to readout or access the listbox in any way in the event case that handles the double-click, it fails. It does not matter whether the "Lock front panel until the case for this event is completed" is true or false. After it fails, you have to unload all the code and reload before LV is able to see some of the buttons on the main panel again (LV7.1.1). You do not have to close LV just the VI's.
    So my first work-around after reading your story was to drive a user event from the doubleclick event case. That user event case then does the stuff I want to do with the listbox. Did not work. I then added a delay of 1000 ms before accessing the attribute node in the other event case, that worked. I then moved all my stuff back into the original event case and added a delay there before accessing the listbox. 100 ms failed, 500 ms works. So at this point I would tend to unexpected behavior from LV which is timing dependent, not "Operator error".
    There is never a problem in any of the ~200 events in the ~20 subpanels. It is always the main panel that is affected. The event handler simply does not "see" some buttons anymore (value change), for example the "mouse down" event would still work for a boolean buttton on the main panel whereas the "value change event" would consistently fail.

  • Radio Buttons and Event Structures

    Guys, I am hoping for some help here on something I probably should know but cant figure out how to do.  I am using a set of radio buttons and an event structure to run a UI.  The radio buttons are acting as both a user input and indicator of current status selected by the user.  I have the event structure set to run on value change of the radio button.  All works great unless the operator decides that he wants to repeat the selection that the radio button is already set to.  The event structure does not recognize this as a change of value and will not execute.  Is there a way to set the event structure up to run even if the same selection of the radio button is made a second time?  I attached a crude example to this post.  Basically everytime I press the button, I want an entry made into the text box, regardless if the selected item was already pressed.  Any thoughts.
    Troy
    Attachments:
    Radio Button Test.vi ‏16 KB

    Instead of hacking around the inherent nature of radio buttons, why not just use a Cluster?  Its behavior in the UI is more customizable.  Check this out:
    I just replaced your radio buttons with a cluster, and added a little logic to the event structure to get it to behave the way you describe.  I've attached the VI below, saved in 8.2, if you want to try it out.
    Hope this helps,
    -D
    Message Edited by Darren on 11-07-2006 10:45 AM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    cluster_buttons.png ‏7 KB
    Cluster Test.vi ‏17 KB

  • Event Structures and Do /While Loops

    I have an Event Structure inside a Do/While Loop.  One of the buttons in the event is STOP which stops the do while.  The Stop Button itself is inside the event as suggested in the help.  My problem is when I hit the stop button everything inside the Do/While runs 1 more time.  Other than than the code works perfectly.  is this normal behavior for a Do/While ..Event Structure??

    The attached file is the code in a nutshell.  I know it can sometimes be diffcult to TS w/o the actual code.  Prob is I wrote it in LV2011 on the Lab PC and I have LV2010 at my desk.  I don't have internet access in the Lab..of course.
    If I hit the OK button 2x's it "does something...does something...build array" then again a second time.  The build array is added to with each click of a button in the event structure.  If the user hits the STOP it dumps the 2x's worth of data out to excel..except I get 3 rows of data rather than 2...as if the inner loop ran one more time.
    Anyways. the only thing that caught my eye is the fact that I don't have a sequence structure around the "build data here" portion of the code.  Would that affect how the STOP inside the do while loop is handled??
    Attachments:
    event_Do_While.JPG ‏90 KB

  • Frontpanel freezes when an event of an already closed event structure occurs

    Hello,
    I´d be very glad if someone could explain to me the behaviour of the attached short and simple vi.
    If you press the OK button #1 once and then the OK button #2 the vi finishes, but if you press the first button more than once before pressing the second button, the front panel is locked. In both event structures, the feature "Lock front panel until the event case for this event completes" is enabled. If it is disabled the front panel is not locked after pressing the first button twice. What I do not understad is why if the feature is enabled the front panel locks after pressing the first button twice. I would think that after the loop containing the event structure closes, the event case should definitively be completed.
    Attachments:
    Event.vi ‏12 KB

    This is expected behavior.
    If you look at your event configuration, both events are set to "lock front panel until event completes". If you fire the second event first, the FP locks and you cannot trigger the first event any more.
    Quick and dirty solution: uncheck "lock front panel...".
    Better solution: learn about dataflow and proper program design. What you are doing here is not a good program architecture. Deadlocks, too sequential,  event structures that cannot be serviced immediately due to dataflow dependency, etc.
    Maybe you can tell us in a more general way what you are trying to do.
    LabVIEW Champion . Do more with less code and in less time .

  • Help with Event Structure!.

    Hello,
    I am trying to config one event structure in the way I could change the range of sample graph to analyze it. 
    I have 3 graphs. The upper is the signal input.  In the middle is the signal fitted with some calculations and the bottom is the graph where I fix the sample width to analyze with anothers values.
    I put event structure in the way I read from file and later update the array of data to force the execution of Case "array 2". 
    Its only one example but I would like to change the value of "start" and " length" of sample signal but I cant get the data to show again. I tried diferent options, like put another event source inside of event case "array 2".
    I could join case 1 and 2, but the problem is with "start and lenght" control, I can`t get its display when i change the values.
    I created a example since its part of my program, to simulate the similar way i need.
    Thank in advance, Fred.
    Solved!
    Go to Solution.
    Attachments:
    example-eventStructure.vi ‏56 KB
    006_RR.txt ‏7 KB

    altenbach wrote:
    billko wrote:
    crossrulz wrote:
    You need to wire up the value of Array 2 to the output tunnel of the event case.  Currently, that output tunnel is set to "Use Default if Unwired".  So since you didn't wire up that tunnel, the value going into the shift register will become an empty array.
    That's one thing I am totally paranoid about.  I hate that the tunnels in an event structure are "Use Default if Unwired" by default, yet they don't show that little dot that suggests that it is.
    Of course they do! What makes you say they don't?
    I actually like the current behavior, especially for the boolean going to the stop button. I would not want to wire it in all the other cases where the loop should not stop.
    Maybe the behavior could be a bit fine-tuned. Automatic "Use default if unwired" should only apply to scalars. Tunnels for arrays and clusters, etc. should require a manual "use default if unwired" setting.
    Ha - it's because of my own paranoia about the "Default if Unwired" that led me to believe this.  I guess I always have something wired to every single case so I haven't seen it in ages.  I created one just now and specifically looked for the dot, and when I added a second case, there it was.  Of course if I wire something to that second case, it disappears.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • Event Structure/UI Help

    Hello,
    I'm stuck.....I am having some trouble figuring out how to make my attached VI behave as needed. The top level VI "EventStructure.vi" is a front panel UI interface to a label printing app (using ActiveX). When the VI is loaded it sits in the internal while loop until either the Print or Exit front panel buttons are pressed. If the "Select Product" drop down has a value change I would like it to go out to the particular label file for that product and read a Serial Number variable from the label file and report back the serial number to the front panel. I would like to have the VI front panel hold that serial number until there is another value change on "Select Product" but right now it only holds it on the front panel until the next time through the while loop. Also, the string containing the path to the label file only holds in memory until the next time through the while loop where it is cleared. Is there any way to have these values hold in memory and only change when there is a value change on the "Select Product" combo box? I do understand that this behavior is the general way Event Structures work but I am unable to figure out a better way to do this without using an Event Structure. The sub-vi "GetNextSerialNumber" calls an external application using ActiveX and it takes a while (4-5 seconds) for that application to load and process the ActiveX commands so I only want to call the external application when there is a value change on the "Select Product" combo box.    
    Solved!
    Go to Solution.
    Attachments:
    EventStructure.vi ‏32 KB
    ActiveX_Print.vi ‏17 KB
    GetNextSerialNumber.vi ‏16 KB

    You need to store any values you want to retain in shift registers. This will allow you to pass the value from one iteration of the loop to the next.
    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

  • Event structure inside a case structure

    Hi,
    I've got a problem w/ my porgram, and managed to boil it down to this
    simple example.  The program basically hangs if you change the
    Numeric value when the boolean is false.  I don't understand
    why.  I suspect it has to do with the way event structures are
    treated, but if someone cou please explain this I'd be greatful.
    Also, now imagine I have 7 numeric controls, handled by 7 cases in that
    event structure, and I actually want to do things in response to the
    value change for each.  Can someone suggest an elegant way to do
    that?  I thought what I had here was a good design, but apparently
    not.
    Bjorn
    (I'm using labview 7.1)
    Attachments:
    EventInCase.vi ‏24 KB

    It is generally a bad idea to place event structures into cases. Events structures need to be able to breathe.
    Maybe you can redesign your program and place the case structure inside the event structure, for example? (Also have a look at the online help for the event structure, especially the link "caveats and recommendations for using events ".)
    Detailed analysis:
    Your event case for the numeric is set to "lock front panel until event completes".  If you change the numeric while the case is false, the evet structure cannot execute, so the front panel locks forever. The observed behavior is as expected. All clear?
    In addition, if the case is false, the main loop spins at nearly infinite rate, consuming all available CPU. Place a small wait to be more cosiderate to everything else running on your rig.
    LabVIEW Champion . Do more with less code and in less time .

  • Event structure in a project using RT target

    Hello.
    As i was already told, i can't use dynamic events on RT targets. Can you suggest me a solution?
    I have the following project:
    Not a Real-Time Project. But project that using RT target: NI cRIO 9074.
    My main VI looks like (part of it):
    It is implemented by  while loop, which runs until START button is pressed. The button pressed after all the values are set, and then the scan begins. 
    When i was developing this VI outside the project, I used event structure for save to new/existing file, show graph buttons (the white buttons). Because it should not interrupt the while loop (user can make setting, then press show graph, then set something again and only then press START).
    It was like here:
    Now, i wanted to bring all the parts together and put that VI in the project. In addition i wanted to add few buttons, like <-- and --> which are moving the motor manually before the scan starts. BUT, it didn't work.
    Now I'm stuck
    How can I implement what i describe above in my situation?
    Thanks!!! 

    Hi Tacchi,
    Are you planning on running your application as a startup executable or from the development environment? If you are planning on running this from the development environment, probably the closest thing you will get to the behavior you currently see with an event structure is by polling the value of the control that you wish to trigger the event. For example, if you wanted an event to be triggered when a button is clicked, you can have a while loop with a case structure inside of it that performs whatever code you want when the value of the button is true:
    Granted this is not the ideal translation, but since RT applications are meant to run headlessly without a front panel, it may be the best option for your application.
    Hope this is helpful!
    Aaron P
    National Instruments
    Applications Engineer
    http://www.ni.com/support

  • How can I stop an event structure detecting keydown events until the vi has initialised?

    My application has a sequence structure with 3 frames. First one initialises some front pane objects and controls, the second communicates with an external device via a serial port to a start condition and waits for this to complete by polling the device. The third contains the event structure which reads the device when the spacebar is pressed. The problem is that any pressing of the spacebar when the application is in the first 2 frames of the secquence structure is stored and executed as soon as the third frame becomes active. I have tried using dynamic Event registration but to no avail. Am I doing something wrong? can the keyboard be disabled until the second frame complete
    s?

    I usually avoid sequence structures in favor of driving execution order through data dependency (error clusters are great for that). However, since you've already got one, you coul try to add another frame right before your event structure. In that frame, place another event structure that can trap that stray keyboard event. Put a tiny timeout value on it so it doesn't appear to "pause" your VI's response. That event structure will catch any bogus key presses that happen during initialization.
    Having said all that, I still think the behavior is not proper. The event should not be handled if it happened before your VI gets to the event structure. For now, you can try that workaround.
    Daniel L. Press
    PrimeTest Corp.
    www.primetest.com

  • Event structure capture event on dimmed buttons

    Hi,
    I have a MMI with buttons I dynamically disable or enable by means of Property Nodes. I capture the Release Mouse Button Event on these buttons with an Event Structure. The problem is that my application seems to recognize this event even when the buttons are disabled and greyed out... What am I doing wrong? Is this a LabVIEW bug? What can I do to prevent this from happening?
    Thanks

    This is the expected behavior: disabling a control prevents the user from changing its value (and other attributes for compound controls like graphs), but does not prevent the control from receiving mouse events.
    You may want to test for a disabled state and filter the event, yourself.
    Good luck,
    -Jim

  • Event Structure, Boolean Control and Value Changde

    I have a boolean control which is related to a frame in an event structure, the action set as Value Change. It worked ok with front panel click but I have problem with triggering it programmatically. I used the Val(sgnl) property node to trig the event. My problem is that it will trigger whenever a true or false value is sent to the property node, no matter it's changed or not. I don't know whether it's the normal behavior or I'm doing something wrong. Anyone can give some advices? Thanks in advance.
    Guangde Wang

    What you are seeing is the expected behavior, Value Signaling always sends the event.  An easy way inside the event to see if that is the case is to compare the new and the old value.  If they are the same then you can do nothing in that event.

Maybe you are looking for