LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find out if current VI is started by user (white arrow) or by asynchronous call

I have a VI, that can be started by the user, but is usually started via asyncronous call.

 

Is there a way to find this out? The Call chain is useless, since it does not contain the calling VI, so it gives the same result in both cases.

0 Kudos
Message 1 of 4
(981 Views)

Sorry, no.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 4
(971 Views)

If this is really needed, then I would consider adding a hidden control to the connector pane, which you would set when calling the VI asynchronously. I would probably go with a timestamp or a counter to avoid having stale values.

 

Another thing you can try is never showing the user the VI itself and instead placing its front panel in a subpanel even when it's not running. That way you can control how you run it.

 

I'm not sure what the use case is for having the user run the VI directly, but I'm assuming they do exist. I expect even so it could probably be refactored for most, if not all, cases.

 

 


___________________
Try to take over the world!
0 Kudos
Message 3 of 4
(966 Views)

The VI property "Execution.State" should be able to tell you if it's "Running" or "Run top level".

 

 

0 Kudos
Message 4 of 4
(930 Views)