07-13-2016 11:37 AM - edited 07-13-2016 11:40 AM
Just use the Prompt User for Input VI.
EDIT: BTW, I used property nodes to set the values before the loop starts which allows the user to change the values whil the loop runs. If you don't want the controls available just erase them and wire the Value outputs of the Prompt User right into your loop and use them directly.
07-13-2016 11:40 AM
This is probably the simplest way to implement this with two controls. With more controls, you should bundle them in to a cluster.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-14-2016 10:23 AM
Hi PalanvielT,
I tried to use event case structures but the values are not updated to main vi. Ihave attached the sample program that I have tried. Could you please tell me where I am doing wrong
07-14-2016 10:33 AM
Hi vk92,
I can take a look if you save for LV 2012. File >> Save for previous...
07-14-2016 10:35 AM - edited 07-14-2016 10:36 AM
You need to stop the while loop when the user clicks cancel or Okay. Really, you can just get rid of the while loop and the subVI will end after the user activates a single event in the structure.
Also, move all of your booleans to inside their respective event cases. This makes the button actuate back to false once the terminal is read from. Otherwise your buttons stay depressed.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
07-14-2016 10:37 AM
Hi
I have attached the 2012 version
07-14-2016 10:41 AM - edited 07-14-2016 10:41 AM
Yes, James has shown you the correct way to do it. Also, make it so that the user cannot close the window, or that closing the window does the same thing as a cancel. Please follow my advice from above:
"You don't need a loop, the event structure will wait until some event occurs. Then you can output the user input in a cluster from the "OK Button" case.
Set the VI to open when called and to close if it was originally closed afterward."
Edit: And of course the re-init to default are not necessary when you are reading the booleans correctly.
07-14-2016 10:48 AM
Hi James. Morris
The problem is solved. But I can open it only once when I am running the program. I would like to open the sub vi multiple times and change the values when my program is running. Could you please help me with this.
Thank you
07-14-2016 10:54 AM
Do not use the stacked sequence structure in your main program.
Put the event structure inside the while loop. Wire something to the timeout (top left of event structure) like 100ms, and put whatever you want to happen in the background there. In this case it looks like updating your graph.