10-13-2010 04:04 PM
I am not sure if it is possible or not. I am trying to use the Run VI , invoke method to achieve the folllowing.
1. I do not want the user to click on RUN icon to start the execution, hence I have hidden this icon from the VI properties.
2. Is it possible (it is only in my imagination), to only let the user say click on a button I provide, to start the execution of the VI
10-13-2010 04:11 PM
@ade77 wrote:
I am not sure if it is possible or not. I am trying to use the Run VI , invoke method to achieve the folllowing.
1. I do not want the user to click on RUN icon to start the execution, hence I have hidden this icon from the VI properties.
2. Is it possible (it is only in my imagination), to only let the user say click on a button I provide, to start the execution of the VI
The VI would have to be running to execute the Run VI invoke node so that is a non-starter. It is an interesting, yet ultimately pointless endeavor to do the hacking required for #2 as you have described it.
It is extremely simple to set the VI to Run when opened (VI Properties -> Execution), and then sit around and do nothing until the user presses the button you provide. This is one case where I use an Event structure without a while loop.
10-13-2010 04:37 PM
@Darin.K wrote:
It is extremely simple to set the VI to Run when opened (VI Properties -> Execution), and then sit around and do nothing until the user presses the button you provide. This is one case where I use an Event structure without a while loop.
Now that is a great idea. I usually spin around in a while loop until the user presses a button. Thanx for the great tip Darrin.
10-18-2011 06:50 AM
Hi,
But I think the VI will run only once when the user clicks the button without the while loop.
I also tried to do the same but there if the user clicks the stop button then he has to click the run(provided by LV) button on the FP to execute the VI.
If he clicks user made run button, then that VI will not execute.
Regards,
Runjhun A.
10-18-2011 09:14 AM
You end up with two seperate vis:
VI1 has the event structure and the button on the front panel. When you press the button it launches VI2 and then closes itself.
VI2 has all the code you want to run when the button (from VI1) is pressed. When the user stops VI2 (or when the program determines that its execution is complete), it relaunches VI1 and then closes itself.
10-18-2011 09:35 AM - edited 10-18-2011 09:36 AM
@ade77 wrote:
I am not sure if it is possible or not. I am trying to use the Run VI , invoke method to achieve the folllowing.
1. I do not want the user to click on RUN icon to start the execution, hence I have hidden this icon from the VI properties.
2. Is it possible (it is only in my imagination), to only let the user say click on a button I provide, to start the execution of the VI
Certainly this CAN BE DONE. see here for a famous example. But READ the thread- this is a silly idea and is not the approach you want to take. Your basic structure is questionalbe at best since it implies a very tight coupling between the GUI (user input) and the Program function. better practice is to use an event loop to respond to user input and pass commands to the "Guts of the process" to control some form of a state machine that does the heavy lifting.
as an example look at the producer consumer (Events) template.