From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-09-2012 07:45 AM
Is it possible to have a separate run button in my own vi? I tried to disable some controls in my vi after the vi is running, but when I stop running, the controls were not in the same condition (still disabled). Therefore I would like to create a case structure to define the boolean type of the run button. If it's stopped, my controls are enabled again.
Solved! Go to Solution.
04-09-2012 07:48 AM
You can't change the Boolean type of a button. That makes no sense. Boolean is already a datatype. It's your responsibility within the code to set up the state of the controls when the program starts up, or to reset them at the end if you don't want to do it at the beginning. It's usually done as part of an "initialization" state of the program to set up the state of the controls as needed.
04-09-2012 08:25 AM
The reason I want a separate run button is I want the boolean data from the run button to plug in the case structure to control my inputs. Is it possible?
04-09-2012 08:27 AM
Your question makes no sense.
04-09-2012 08:33 AM
Put a small loop inside a big loop then use buttons in the small loop to decide (when or if) to start execution of the rest of the code outside the small loop or exit.
Use the boolean output of the small loop to execute an appropriate case frame in the bigger outter loop which does the actual work of the loop. IF you need buttons to reappear after the case finishes you can put the property changing nodes of the controls you want inside the case after the main code is executed or in some cases you can have it execute outside the case.
The bottom line is if you want to simulate running a program (having a separate run button) you have do the enabling of certain controls yourself and simulate it by using a the loop in a loop.
Sorry, I am not a clear writer when I am in a hurry so I hope it was helpful. 🙂
04-09-2012 09:54 AM - edited 04-09-2012 09:56 AM
I hesitate to provide this link because it is NOT the solution to your problem. But I cannot resist simply because of the novelty of it. Christian posted this a while back. It shows how to run a VI using an X-Control. Pay attention to his disclaimer - even though something is possible does not mean it is a good idea
Looking at your original post it sounds like the problem you are trying to overcome is that you have disabled some controls and want them reenabled the next time you run the VI. The answer is simple - reenable them when the program starts. This is an example of how you can enable all controls.
04-09-2012 10:04 AM
How could you get those icons in the picture you posted? This is my vi. Which case of the events should I put it in? or put it outside the loops?
04-09-2012 10:18 AM - edited 04-09-2012 10:23 AM
Just put down a property node. It is an "App" property so you need to change it to a VI property. Right click and then go to "Select Class/VI Server/VI/VI"
Click on Property then select "Front Panel". Now the easy part. Click on the output of "Panel" and "Create Property Node" and browse to the "Controls[]" array property. Wire that to the for loop. Inside the for loop just place a property node and wire the indexed tunnel to it. Browse to the "Disabled" property and change it to write.
If you want the controls to always be reenabled when your program starts then place this code to the left of your loop. Wire the error out from the property node inside the for loop to your main loop. Right click on the error out from the for loop and disable indexing. Even better make it into a shift register and wire the error from the first property node, through the second property node, then to the left side of the shift register in the for loop so it looks like this
04-09-2012 10:31 AM
Thank you so much!!!