LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get the run state of a vi?

Hi folks,
 
within a main vi I open a reference to a subvi, display the panel of this subvi in a subpanel on the panel of the main vi and run the vi there. In that subvi I register for a "value changed" event of a control in the main vi. However, if I want to test the subvi independently while the main vi is not running, I need to drop the registering. Otherwise I get an error message.
 
How can I check within the subvi whether the main vi is running? In other words: How can I get the run state of a vi from inside another vi?
 
Thanks,
Peter
0 Kudos
Message 1 of 8
(3,566 Views)
You can check if the reference is valid before registering. Otherwise don't register or register for a control you use for simulation.

Felix
0 Kudos
Message 2 of 8
(3,560 Views)

Felix,

please, give me a hint. I can't find a method how to check the validity of a reference.

Thanks,

Peter

0 Kudos
Message 3 of 8
(3,554 Views)
In the Comparison palette, there is 'NaN/Not A Path/Not a Refnum' Primitive.

Felix
0 Kudos
Message 4 of 8
(3,548 Views)
Thanks. But the ref number is also valid if the vi is not running. Apparently I still need an information whether the vi is running or not. How can I check this?
0 Kudos
Message 5 of 8
(3,537 Views)
Is your reference passed from the main VI into a control or did you obtain it a different way? Because this way, you will have a refnum on your control when you call it from the main vi once.

But there is an alternative you can use: Application Control Palette has a 'Call Chain.vi'. With that you can check if your vi is called by the main vi or run as 'standalone'.

Felix
0 Kudos
Message 6 of 8
(3,531 Views)
Use the VI property Execution>State. Or, simply run it and check the error.


Regards,


Wiebe.
Message 7 of 8
(3,530 Views)

Thanks a lot, your hints really helped. It works now.

Bye, bye,

P.

0 Kudos
Message 8 of 8
(3,518 Views)