LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass data from subvi to vi by calling subvi with "latch until released/pressed" Boolean?

Solved!
Go to solution

I'm trying to do the following: when user presses a button, a new window pops up, user types in numeric value, that value is passed to main vi. 

When user either user closes second window or depresses a button, I want code to be in the initial condition (numeric value passed to main and button is reset). If user presses a button again, the window pups up again, etc. 

 

I've tried all combinations of SubVI Node Setup and Call options but can't achieve what I want. My code is only able to read by setting Boolean button to "Switch when pressed" mechanical action. This makes me unable to use "Close afterwards if originally closed" Subvi node setup because my main vi keeps constantly trying to open and then close the subvi. If I use any other Boolean mechanical actions, it opens the subvi just once and then doesn't pass any data back to main vi because the Boolean is reset to 0. 

 

There must a trivial solution to this, no?

Download All
0 Kudos
Message 1 of 3
(410 Views)
Solution
Accepted by topic author John32d

Apologies, found the solution:

 

https://forums.ni.com/t5/Example-Code/How-to-Open-a-SubVI-as-a-Separate-Window/ta-p/3531906

 

Please mark as resolved. 

0 Kudos
Message 2 of 3
(387 Views)

You really don't need any of that code:

 

  • The boolean on the main VI needs to be "latch when released", because you only want one TRUE per press and reset afterwards.
  • You can use an event for panel close to return to the caller.
  • The subVI should be set to "dialog", no need for subVI node setup, etc.

 

altenbach_0-1697660298118.png

 

 

 

Here's a quick draft but I would recommend to make the UI a bit more as expected (not shown!), e.g. the dialog should have a OK and cancel button and [x] should act as cancel, you should have an input to define the default value which will be retained if the dialog in canceled, etc., etc.

0 Kudos
Message 3 of 3
(367 Views)