LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I keep a vi from running until I've completed entering a string?

I don't want the vi to execute until I hit return.
0 Kudos
Message 1 of 21
(2,221 Views)
Well we need a little more detail about your program. Either post the code or give more detail about the structure of the code you are developing.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 21
(2,220 Views)
Objects_sub starts sending out data from the object string as soon as I hit run.
0 Kudos
Message 3 of 21
(2,214 Views)
well your code is working just like I thought (the way it is designed) You need to implement some type of coding structure. Right now the way you have your code setup is when you hit the run button everything starts to run. they way you want it is for your program to do nothing until you hit the enter button. Have a look at the shipping examples for event structure and implement it into your code. Set up the event structure to fire the event on vaue signaling of the string control and it will fire the event and process the code inside the event when you hit the enter key.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 4 of 21
(2,210 Views)
I can do that but why does that attached code work without an event structure?
0 Kudos
Message 5 of 21
(2,196 Views)
explain what you mean by WORKING! yes it works but it does not do anything until you hit the run button and then it executes. This is the same thing your code is doing now. If you want your code to react to you hitting the enter button then you will need to implement the event structure or some type of code that allows you to capture the "ENTER button".



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 6 of 21
(2,190 Views)
I'm confused.  Stringtest doesn't transfer data from string1 to string2 until I hit enter.  Object_sub starts immediately when I hit run with whatever has been stored in the control.
Is it operating differently for you?
0 Kudos
Message 7 of 21
(2,183 Views)
All you programs you posted are simple linear code.
 
A finished program needs a while loop, event structures, possibly a state machine layout. The program should always run, but most of the time just wait for input, e.g. with an event structure.
 
In your case, you would start out in an "input" state. Whnever one of the inputs changes, you would validate the unput to make sure it is OK. If not show some red text and go back waiting for input. One all inputs are valid, you would proceed to the next state, etc.
0 Kudos
Message 8 of 21
(2,187 Views)


@exo wrote:
I'm confused.  Stringtest doesn't transfer data from string1 to string2 until I hit enter.  Object_sub starts immediately when I hit run with whatever has been stored in the control.
Is it operating differently for you?


If this is really what is happening then something is definetly wrong with your LV. LV does not work this way. it should work like this.
  1. Enter text in string control
  2. Hit run button in toolbar.
  3. VI executes.
  4. Text is visible in string indicator.
The way that you stated that you wanted your VI to work is:
  1. Hit run button in toolbar.
  2. VI waits for input.
  3. VI captures press of enter key after entering information into string control.
  4. VI executes.
  5. VI waits for input or close.
The only way to implement this is to set up your code with some type of programming structure. (ie event structure, state machine,a while loop with a conditional loop).

Have a look a some of the examples they are a great place to start. And for beginners I would suggest that you take some of the free online tutorials or buy the book called LabVIEW for everyone third edition.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 9 of 21
(2,172 Views)
If I put the two codes in highlight step mode. One code does nothing until I hit return. Both codes start with a string control. One code starts immediately.  What's the difference?  So what if they're linear or don't have while loops etc.  There is some fundamental difference right at the start.
0 Kudos
Message 10 of 21
(2,167 Views)