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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create another run button in the vi?

Solved!
Go to solution

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.

0 Kudos
Message 1 of 9
(2,482 Views)

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.

0 Kudos
Message 2 of 9
(2,481 Views)

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?

0 Kudos
Message 3 of 9
(2,472 Views)

Your question makes no sense.

0 Kudos
Message 4 of 9
(2,469 Views)

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. 🙂

 

 

 

 

 

 

0 Kudos
Message 5 of 9
(2,466 Views)
Solution
Accepted by topic author Bombbooo

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 Smiley Happy

 

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.

 

Example_VI_BD.png

=====================
LabVIEW 2012


0 Kudos
Message 6 of 9
(2,449 Views)

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?

0 Kudos
Message 7 of 9
(2,441 Views)

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

 

Example_VI_BD.png

=====================
LabVIEW 2012


Message 8 of 9
(2,435 Views)

Thank you so much!!!

0 Kudos
Message 9 of 9
(2,426 Views)