LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

xcontrol problem in exe

Solved!
Go to solution

I have an xcontrol with a push button. When the button is pushed there's a check whether the vi is running or not. Problem is, when opening the vi as a built exe the xcontrol always says it is running, even if it's not!

 

What is going on?

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 1 of 10
(4,130 Views)

More than likely it has something to do with the "check" to see if the VI is running. The path for the VI changes when it's rolled into an exe. You have to strip the program name out of the VI path when it's an executable.

If this isn't the case then provide some more information and a png and zip of the VIs if possible.

________________________________________________________

Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
________________________________________________________
0 Kudos
Message 2 of 10
(4,117 Views)

The VI class property Exec.State returns the value Running not only when the VI is actually executing, but as long as it's not idle (meaning statically called by another VI which is running). Because in an executable the top level VI starts running automatically, all the VIs in its hierarchy are in the Running state.

 

I don't think there's a way to know whether a VI is actually running or not without adding special code to it, such as setting a flag when it starts running and unsetting it when it stops. XControls already do this, where you get a special flag in the XCtrl, but I'm assuming that's what you're already using and it shows you that the VI is running (because it's actually checking the State property of the VI).

 

In any case, you should be aware that even if you load the VI completely dynamically and it's not actually in the Running state before you explicitly run it, there are still many things which you can't change in an executable.


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

@O.P. wrote:

... there's a check whether the vi is running or not...


What kind of "check" are you doing? Please be much more detailed!

What is the use of a non-running state in an executable? Can you explain?

0 Kudos
Message 4 of 10
(4,100 Views)

I have an XControl with an event for a push button:

 

3.png

 

If I drop the control in a VI and press the button, I get:

 

1.png

 

If I build an exe and start it, pushing the button yields:

 

2.png

 

Thing is, I haven't started the VI yet!

 

Lars Melander
Uppsala Database Laboratory, Uppsala University
0 Kudos
Message 5 of 10
(4,088 Views)

I guess the XCtrl data always shows that in an EXE because it assumes the VI is always running, even though the white arrow indicates it should be in the Idle state.

 

In any case, what's your actual use case for this? It's unusual to have an idle VI in an executable. Normally, the UI shown to the end user should always have running VIs and never show the toolbar.


___________________
Try to take over the world!
0 Kudos
Message 6 of 10
(4,082 Views)