LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you have a Labview Event structure run a default event when it starts?

I have a dialog window that containing an event structure to run specified event cases when the dialog's Start, Okay, and Cancel buttons have value changes.  I would like to have the Start event case run automatically when the dialog opens instead of having to have the user click on start in order to perform the Start event case.  I've tried using value signaling to change the value of the start button.  This did not work--probably because I sent the value signaling before the event structure was started.  How can I force an event case to run when a event structure is initially started?
 
Thank you for any suggestions that you can give.
 
Ken
0 Kudos
Message 1 of 10
(8,162 Views)
Using value(sgl) will work and I use it all the time for this purpose. Please attach your code so we can see what's wrong. 🙂
Message 2 of 10
(8,158 Views)
Do you need a "Start" button or are you just using it as a way to trigger the event?
 
From the information you provided I would encourage you to look at a state machine with events. I attached a very simple mock up for your review.
0 Kudos
Message 3 of 10
(8,145 Views)
If the only purpose of the start control is to trigger an initial event, maybe you don't even need it. 🙂 Often, you can recruit the timeout case for this. The attached image shows two typical scenarios.
 
TOP uses the timeout event to spin the loop once and execute some initial code.
 
BOTTOM uses val(sgl) of a boolean.
 

Message Edited by altenbach on 06-07-2007 09:33 AM

Message 4 of 10
(8,146 Views)

Hi Christian,

I had never thought about using anything other than a constant before I saw you post this construct (in a previous thread).

You get bonus points for sharing this simple but elegant idea.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 10
(8,135 Views)
of course the diagram comment on the left should read "...until the property node has finished..." 😄
0 Kudos
Message 6 of 10
(8,134 Views)
Your bottom example is similar to what I initially tried.  The difference was that I fed a constant into the value signaling function instead of the value from the button.  I've now tried it using your way and it did not work either.  Beside not working, your way also causes the button to stay latched--I normally but the button control inside the event case so that it gets automatically read and thus unlatched.
 
Yes, I do need the Start button because I want the user to be able to restart the measurement.
 
I figured out that your suggestion works if I disable the latching feature on the button.  However, changing the button operation to "switch until released" causes me to get two start msg each time the Start button is clicked.  I think I can make your approach work by creating a second hidden button that receives the value change when the dialog starts and change my Start event case to look for values changes in the Start and Hidden button events.
 
Thank you for your help.
 
Ken
 
 
0 Kudos
Message 7 of 10
(8,125 Views)
Ken,

Most likely your value signalling property node outputs an error when using it with a latched boolean!
Always check for errors!
Altenbachs code clears the error silently as well.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 8 of 10
(8,108 Views)
You cannot use a latch action boolean with a value property node.
Just use a switch action, and inside the event case, write a FALSE back to a local variable of the switch to simulate a latch action. 
0 Kudos
Message 9 of 10
(8,103 Views)

Thanks for the tips, I think you have me straightened out for now.

Ken

0 Kudos
Message 10 of 10
(8,088 Views)