Hello:
I am working on an application where a main User Interface will need to open a subVI for a motion control system asynchronously using a menu selection. The motion control subVI should run independently in its own window separately from the main application that initiated it. I have the code working using the following ...
This works fine up to a point... the subVI opens in its own window and runs independently in its own window. I use VI server within the subVI to open its front panel on startup.
The problem occurs if the subVI hasn't been closed/stopped yet and the user selects the menu item again from the main UI. An additional instance of the subVI is queued up serially. If the user then stops the subVI then the other instance starts right up again.
What I thought would work to avoid this problem is to check to see if the subVI is already running when my menu event triggers and if so just bring its window to the front using some code like...
and then if it is Idle I would call the subVI asynchronously using
However, the VI server call for the execution state never returns idle. It always returns Running even though the subVI hasn't been started yet. I was surprised by this, expecting it to return Idle when the subVI hadn't been called yet.
Does anyone have suggestions for starting this subVI and if then if it has already been started to just bring its front panel to the front?
Thanks,
Doug Harper
PS. Please ignore the incorrectly labeled global variable that is passed to my subVI. I had this in there temporarily and forgot to change it before taking screenshots. It doesn't have any bearing on my question.