LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I programmatically trigger a user dialog that does not hold up the rest of my .vi?

I am trying to prompt the user to take action based on events in a .vi, but I don't want the .vi to wait for the user.  (i.e. I want the .vi to keep doing its stuff, loops running, measurements being taken and analyzed, etc. no matter how long it takes the user to get around to responding)

 

If I just use a normal 'user-dialog' subvi, the program waits for a response.  How can I break the .vi's dependency on the user dialog?

 

Thanks,

Sean

0 Kudos
Message 1 of 4
(2,464 Views)
Have you thought of using 2 loops. First loop contains your usual processing and a second loop to do all your interfaces with the user. You can then use queus, action engine, global variables, etc... to communicate with the first loop.
0 Kudos
Message 2 of 4
(2,462 Views)

Hey Joe,

 

Thanks for your reply. 

 

I do actually have several independent loops, because I don't want the various resources to conflict with each other.  Most of the UI is handled by another loop, but I've found that it is very easy to introduce problems when setting up communication between the loops. 

 

To safely implement it through the UI loop I would have to add an additional variable.  Then I would have to flag it in the calling loop, detect the change in the UI loop, revert the boolean variable, and call the user_dialog (preferably without causing the UI loop to be non-responsive to calls/changes from other parts of the code).

 

I was hoping to just spawn a temporary independent thread to handle this case (and avoid unnecessary complications).  It seems like it should be possible, but....

 

 

0 Kudos
Message 3 of 4
(2,458 Views)
A producer-consumer architecture has the proper setup for two loops, with proper communication between the two loops. In regards to your specific issue you can launch the dialog using the VI server functions. This will allow you to run the VI, and immediately return to your program. Search the forum - there's lots of examples on dynamically launching a VI, as well as examples that ship with LabVIEW.
0 Kudos
Message 4 of 4
(2,455 Views)