Avoid duplicated button clicks in event structure

Hello,
I have a seemingly easy problem that I can't seem to solve. I am attaching a VI that exemplifies my issue.
My problem is this: when an event is running the OK button is disabled, but if the user clicks on it the event is queued and, when the current process is finished, another one will start right away. The only reason why I disable the button is to avoid this event queuing. The mechanical action of the button is set to Switch until release (so that the button comes right up after I let go of it).
How can I avoid this?
Thanks!
Solved!
Go to Solution.
Attachments:
DoubleEvent.vi ‏13 KB

First of all, your button should be set to the default of Latch When Released.  Then put the terminal for the button inside of its Value Change event case.
You are actually causing two value change events with the switch until release: 1) true when you press the button, 2) false when you release the button.  By using the latch, then you will only have one change event.
Also, interestingly enough, I found that if you turn off the "Lock front panel" option in the event case setup dialog, then your issue goes away.
You should also make a way to stop your loop.  Using the Abort is a big no no.
Attached is a cleaned up version of your code that I put together.
EDIT:  Ok, I must have taken way too long to play around with this VI...
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
DoubleEvent.zip ‏7 KB

Similar Messages

  • How keyboard control Button in Event structure

    Hello
    First I am Just a beginner in Labview 
    I just make a program that Consist of 4 button controling 4 LEDs Using Event Structure
    The Problem is I did not want to operate the button by the mouse click but
    i want to operate the button using the arrow keys in keyboard
    T
    Attachments:
    Arrow key control LEDS.vi ‏10 KB

    Hi saiko,
    when you're a "total newbie" you should at first go through all those free online LabVIEW courses offered by www.NI.com!
    Try this:
    My stop and clear buttons also doesn't seem to wor​k when I put in the event structure.
    How did you configure the event case? When putting those buttons inside the event structure you have the tell that structure how/when to handle them. Did I mention the free online courses?
    but I can't get it to switch until release when I ​hold down on my keyboard.
    Do you want to use the automatic key press repeat feature? Well, you have to configure the event: right now it's "key press", but you probably want an event like "key repeat"? You may read the LabVIEW help on available events...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

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

  • Change the condition in event structures

    Hi all,
    I am a student, currently doing a project. I'm very new to labview and I don't really know much of the function in labview. Anyway, I have this timer made using event structure if I'm not mistaken (I downloaded this timer from one of the post in this forum). This timer will start at 0s, count to 20s, then stop. So what can I do to change the end time of this timer?? Let's say stop at 50s??
    Attached is the program. Kindly please explain to me or modify the program and attached back as a reply. I've been trying to figure it out from the help function, but still don't understand.
    Thank you very much in advance!!!
    Solved!
    Go to Solution.
    Attachments:
    TIMER s.vi ‏13 KB

    Hi,
    Thanks for your inquiry. The VI attached uses a couple of programming structures: While loop, Event structure and Case structure. What you would have to change is actually the case structure. Before we go to that, let us go through the different structures. Open up the block diagram by going to the Menu bar of the front panel and navigate to Window->Open block diagram.
    The While loop is like a Do Loop in text based programming. It will execute until a condition is met. From the attached VI, it stops running when you click the exit button.
    The Event structure is a structure which consists of subdiagrams. The structure responds to interactions with front panel objects. For example, if you click the start or stop button in the front panel, the event structure will switch to a case which corresponds to this interation. In the attached VI, the case, which corresponds to intreaction with the start or stop button, is called  "Start", "Stop": Value Change. Each case will contain an event-handling routine.
    Case structures are like switch statements in text programming. Take a look at the "Start", "Stop": Value Change event. It contains a routine which consists of a case structure. The case structure responds to the input terminal called Start (which is actually the start button on the front panel). The case structure switches between cases according to this input. To view the different cases just cycle through the case structure by clicking the left and right buttons. There are only two cases: True or False as the input is a boolean.
    Now lets take a look at the VI. Take a look at the "Timeout" case of the event structure. This is where the modification needs to be made. Modify the case structure by editing the cases. Change the numbers in case structures: ..20000 to ..50000  and 20001.. to 50001.. This should do the trick.
    Regards,
    Alan Bong

  • 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

  • Successive run - Event Structure

    Hello...
    I have a simple question. Sometimes we want to use Event Structure and put only a piece of the code in each case. The problem is that a case might have only math code, without any control, indicator or array. Because of this, this case will not have any "thing" that can trigger its execution. 
    To avoid this and allow me to control in arbitrary form the execution of the cases, I created a simple code where I can specify which case will be runned after a especific case.
    Attached there is a example just to show how it works.
    My question, is there a better way to do this?. I mean, specify that after one specific case runs, another specific case will run.
    Thanks in advance.
    Dan07
    Attachments:
    Event Structure Run.vi ‏30 KB

    There are various problems with trying to use the event structure itself to be the case selector for a state machine:
    You can't guarantee that cases will execute in a particular order, because other registered events could fire during a sequence and interrupt the intended chain of events. For instance, if a user presses a button while the event structure is in a sequence where it triggers itself repeatedly.
    It takes a lot of effort to create these hidden controls that only exist to fire value change events. And it makes the code confusing because they serve no real purpose. Yes, User Events are the preferred solution to this problem, even if they require more wiring and control, but they don't solve the first problem in the list.
    A better solution might be something along the lines of a Queued State Machine architecture. It's a mix inside one loop of an event structure and an outer case structure. It's a little difficult to explain in words, but there's a good template free to download from JKISoftware that also has a tutorial video about it that you can learn more about here. I've recommended this before, but I promise I don't work for them or anything It's just good technology and a lot of thought has gone into it. JKI didn't invent the paradigm, but they've implemented it pretty it well.
    It seems to solve a lot of the problems you have. It allows for user interaction through the event structure, and it allows you to trigger a sequence of cases not related to controls or indicators that have events registered for them. And it solves the two problems listed above. The architecture is inherintly self-documenting and clear, and it avoids the pitfall of allowing user interaction to unintendedly interrupt import sequences of events.  The downside is that it's not the simplest of architectures, but it's also not the most complex. Check it out!
    Jarrod S.
    National Instruments

  • Event Structure Freezes Vi After Capturing The First Event

    My Event structure catches the first instance of my button press but then it freezes my Vi.  The reason is because of the while loop but I need the while loop to constantly read from a serial port and send data to a serial port. The vi included is stripped down to be just a while loop that does nothing.  I have also tryed putting the event structure in the while loop, but the same thing is happening.
    Any ideas?
    Thanks,
    Cason Clagg
    SwRI
    LabView 7.1, Windows XP

    Also, put the button inside the event structure where it is acted upon, from LV help (suggest you read the entire events section of help):
    When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a Value Change event on a latched Boolean control.
    Refer to the Handling a Latched Stop Boolean Control in an Event Structure caveat for information about how to handle a latched Boolean control.
    When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a Value Change event on a latched Boolean control.
    Refer to the Handling a Latched Stop Boolean Control in an Event Structure caveat for information about how to handle a latched Boolean control.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

  • Multiple events structures for same control

    Hi,
    I would like to use a same blinking button into 2 event structures seperately.
    Please see my VI, after the first event is done, the second event is not wait for user to press the button, and it is auto triggered.
    How to solve that? Is there any way to reset the event?
    Thanks.
    Attachments:
    2 events.vi ‏13 KB

    It is also not clear what you are trying to do with the blinking. In your code, the LED will blink basically always. (you don't use the timeout event).
    In the first frame, blinking is enabled. Nothing happens in the second frame until the start event occurs. At this time blinking gets disable for about a nanosecond and gets immediately enabled again in the third frame. Even if the second eveng would not execute, you'll never see a difference. So what's the point?
    Here's a quick draft where each press of the start button toggles between blinking and not blinking. Maybe it can give you some ideas.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    2 eventsMOD.vi ‏10 KB

  • Event structure compactRIO

    Hello
    Can I use an event structure on a diagram running on the CompactRIO
    controller? I try to use a button in an event structure but the code
    inside the event "value changed" never runs.
    Thanks

    Hello David,
    A LabVIEW RT program should be programmed as if the front panel is not
    there.  In an embedded LabVIEW RT program, when you write to a local
    variable it does not update the front panel, since the front panel is
    not downloaded with the VI to the target. So it normal that events based on "value changed" doesn't work (Cf. this KnowledgeBase).
    Cordially,
    .mrLeft{float:left} .mrInfo{border-left:solid 1px #989898;font-size:x-small;color:#989898}
    Mathieu R.  
      CTD - Certified TestStand Developer / Développeur TestStand Certifié  
      CLAD - Certified LabVIEW Associate Developer  

  • Event structure will hang if i click the button fast

    i trying to debug the program, and i realise that the event structure will hang the program is if i click the button that event structure detecting fast,
    it will hang and stopped there...
    is this a bug or what?
    even i place a time delay in it also no use...
    the event is mouse down for button

    Hi AxE,
    I apologize for the oversight. Please find the attached VIs (now converted to LV 7.0). Apart from changing the "mouse down" event to "value change", I have also changed the mechanical action of booleans to "latch when pressed" . This would change the value of the button only during the duration it is pressed. As soon as it is released, the value of the button will revert back to its default value('false' in our case) so we dont need to change the value of the button inside the event case.
    Windows.cpp error in Line 2978 has indeed been reported to National Instruments. The LabVIEW R&D team is investigating the error.
    Regards,
    Ankita A.
    National Instruments
    Attachments:
    AxE's_TDS_420A_Application_Test.vi ‏155 KB
    CallWF.vi ‏20 KB
    RecordWindow.vi ‏182 KB

  • How to stop While Loop in Event Structure with same button?

    Hello,
    I have a problem. I want to use one control to activate an event in a event structure, and the same control to terminate a while loop in that event.
    It is possible to use 2 controls to do this, but I need it to be only one.
    Thank you  
    Message Edited by Heinen on 02-19-2009 06:16 AM
    Message Edited by Heinen on 02-19-2009 06:20 AM
    The Enrichment Center is required to remind you that you will be baked, and then there will be cake.
    Solved!
    Go to Solution.

    Hello,
    I have a bit different problem.
    I have a tab control, with several buttons on different pages.
    In the current situation, we can talk about two pages, where one page ("Settings") in the Image, has a START and EXIT button, while second page ("Wait") has an EXIT button.
    In a while loop, I have event structure, which handles events of the START and EXIT buttons of the Settings page. This is fine. But I also want to control the Exit button of the Wait page.
    The control works like this:
    When I click on Start in the Settings page, the front panel shows Wait page and attempts to connect to a datasocket server on the remote computer. If the user wants to stop this process, he can click on Exit on Wait page too. But, this doesn't give any immediate effect. On the even of Start button, the front panel is not locked, so the user can actually click the Exit button on the next page when it's visible. But it's of no immediate effect. Means, what the LabVIEW does is, finishes the execution of event in Start button's click, and while this executes, it doesn't consider the Exit button's refreshed value (shown in Red circle in the block diagram).
    Simple question: Is there any way to check the updated (latest/live) value of a control during some event's execution? Or if I write an Event "Value Changed" for the Exit button and pass it to some variable. Is it the only solution?
    Thanks ahead.
    Vaibhav
    Attachments:
    terminate event_diagram.jpg ‏200 KB
    terminate event_front_1.jpg ‏63 KB
    terminate event_front_2.jpg ‏63 KB

  • DAQmx in Event structure / avoid multiple events

    Hi all
    I've started creating program for acquisition and analysis of data . I don't have much experience in LabVIEW, but it's important to me to start creating this application in good way. Can you give me some advice about things below?
    I prepared template with Event structure, based on some article .
    First question is how exactly place DAQmx blocks in it. Now they are all on one state of case structure "test", but I'm not sure that's correct because most of the example on NI side have initialization (like sample rate, number of saple) outside of the loop? It's important to make it possible to change parameter between measurements.
    Second. How to avoid multiple events. In example: button TEST is pressed, measurement is taken. This measurement take a long time. I've started bored, and some other buttons (maybe TEST ) accidentally were pressed. When measurement is completed  it would be good idea to destroy this events associated with accidently pressed buttons. It is possible to do it? What's the best way when there's a lot of buttons(when analysis part of program will be added)?
    Best Regards
    PS. sorry about my english
    Attachments:
    pgm.vi ‏33 KB
    Enum_Events.ctl ‏5 KB

    Dear Finch!
    Welcome to NI Forums!
    My first advice regarding your code would be to use shift registers instead of Queues as your state storage, since (as you've said) there is no reason to store multiple events that have happened. The state machine design pattern, which I strongly recommend in this scenario is built into LabVIEW, you can use it as a template if you go to the New.. menu.
    Please check out these materials for further discussion about state machines.
    You are correct in that most of the DAQmx VIs can be placed outside of the loop, only DAQmx Read (the function we actually use more then once) must be placed inside the loop, the rest can stay out. If you want to modify some parameters (like Timing) mid-execution, you only have to stop the task, set them, then start it again.
    This can be easily done in a different state, which can execute only when some parameters have changed.
    Also, if you want your user to be unable to interact with certain controls while the test is being taken, you can programmatically disable them with a Property Node. 
    Please get back to me if you have any other questions.
    Best regards:
    Andrew Valko
    NI Hungary
    Andrew Valko
    National Instruments Hungary

  • Buttons stay pressed when using event structure

    I have an event structure in a while loop to handle various buttons the user can press.  I used this instead of case structures on the buttons because I have some advanced events I want to happen to the controls as well.  Code wise it is working fine, but the buttons are not release when you press them.  They only change once when pressed.  So if they are released and you click them they stay pressed.  If you click on them again, they release.  This is very ugly.  What am I doing wrong?  I have tried changing thier type to switched vs latched and it makes no difference.  I tried changing the event on them as well and that doesn't seem to matter.  Currently I have "mouse released" on the button as the event trigger.

    Hello Muffin,
    If you have the buttons configured for "latch" operation (reset after being read, which sounds like what you want), the button will only reset when it is actually read within the code- are they connected to anything or read somewhere within your application?  The simplest way to ensure the buttons are read when the event is triggered is to place them within the mouse-up event.
    Regards,
    Tom L.

  • How to call elem. Search help on Button click event in WD appilcation

    Hello All,
    i have requirement to call elem. search help on button click event in WD application. currently i am calling FM  F4IF_START_VALUE_REQUEST but getting the short dump as below,
    The following error text was processed in the system X31 : Screen output without connection to user.
    The error occurred on the application server saps_X31_31 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    SYSTEM-EXIT of program SAPLSDH4
    Function: F4_PRESEL_WITH_TABSTRIP of program SAPLSDH4
    Form: F4PROZ_STEP_PRESEL of program SAPLSDSD
    Function: DD_SHLP_SINGLE_STEP of program SAPLSDSD
    Form: F4PROZ_LOOP of program SAPLSDSD
    Form: F4PROZ of program SAPLSDSD
    Function: F4IF_START_VALUE_REQUEST of program SAPLSDHI
    Method: ONACTIONSEARCH_CUSTOMER of program /1BCWDY/50TU5ZEXF3K0IWCWE153==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/50TU5ZEXF3K0IWCWE153==CP
    Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP
    is there any way to achieve the required behaviour.
    please let me know.
    Regards,
    Chandra

    Hi Friends,
    I have the similar kind of requirement. Upon click on a Button on screen i need to call a search help, and collect one or more selected material numbers.
    The search help is working fine and i am getting the entries with the following code.
    The problem is i am finding extra popup on screen.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
    tabname         =  space
    fieldname       =  space
    SEARCHHELP      =  'MAT1'
    MULTIPLE_CHOICE =  'X'
    STEPL           =  0
    value           = 'MATNR'
    *dynpprog        =  progname
    *dynpnr          =  dynnum
    *dynprofield     = 'CARRIER'
    CALLBACK_PROGRAM          = 'ZTEST_1_PRA'
    CALLBACK_FORM             = 'F4CALLBACK'
    TABLES
    RETURN_TAB                = RETURN_TAB
    EXCEPTIONS
    FIELD_NOT_FOUND           = 1
    NO_HELP_FOR_FIELD         = 2
    INCONSISTENT_HELP         = 3
    NO_VALUES_FOUND           = 4
    OTHERS                    = 5.

Maybe you are looking for