11-16-2016 01:15 PM
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.
11-16-2016 01:33 PM
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.
11-16-2016 01:34 PM
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.
11-16-2016 01:53 PM - edited 11-16-2016 01:53 PM
I attached version 12. Can you tell me how change it in app?
11-16-2016 01:56 PM
I don't think you should be messing around with call by reference. Just set your SubVI to "open when run" and "close afterward if originally closed".
11-16-2016 02:00 PM
I try to set "close afterward if originally closed", but this doesnt help. 😕
11-16-2016 04:38 PM
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.
Main.vi:
Sub.vi:
11-16-2016 05:17 PM
Here is a simple example to show how to use a sub VI to get a user input.
11-17-2016 03:05 AM
... 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.
/Y
11-18-2016 02:17 AM
Hi,
there are many ways how to do that. Check out my modification of you initial example. It really depend if you need non-blocking or blocking dialog window.
BR,
Ondřej