Simple application. In main VI i click button for new window with subvi. In this subvi i can choose value from menu ring. When i click diffrent button on main VI i want to send what is choosen in subvi, to indicator in main VI. Why this doesnt work?
Solved! Go to Solution.
Can you save your code for LV 2012 or earlier?
What I usually do with a popup is wait until the user presses an "ok" button and then close the SubVI. Make the value an output of the SubVI, and wire directly to the terminal on MainVI.
You can also send in a control reference and update via property node.
In theory, your subVI is still running, so any calls to the subVI while it is running will be blocked. You should use a Queue or User Event to send data to your subVI. Look up Queued Message Handler for some good ideas.
In order to respond the changes to front panel values, the SubVI launched using VI Server calls must be running in a loop and passing data to any other code that is running in parallel to it. The mechanism to handle passed data could be Notifiers, Queues, *gasp* functional globals, or *gasp* *gasp* global variables. Since you're concerned with only the last value, the recommendation here is a Notifier.
Create a Notifier and pass its refnum to the SubVI that you launch using VI Server calls. The launched SubVI can then write to the Notifier and the Main VI can read from the value from the Notifier.
... or you have an OK button in the popup and simply connect an output with the value. Or even simpler, you can use the Express VI Prompt user for input for the same effect.