03-05-2013 03:01 PM
I have a Sub VI that I am using to launch a panel where the user makes a few selections and then hits done. This happens inside a while loop. I have taken the boolean associated with the while loop and wired it to the output of the Sub VI.
I'm using this sub VI inside my main VI, and what I"m trying to do is hide the main VI's front panel until the user presses 'Done' on the sub VI.
The problem is that even though I'm explicitly setting the value of the boolean to be false inside of a flat sequence strucutre, it still appears to be uninitialized in my main VI. I say this because I set a probe and it simply says "Not Executed" until I press done, at which point it becomes true. I was expecting this to say 'false' until I pressed 'done'.
I have looked through the forum here, and have also tried setting its default value through LabView, both with no luck. Can anyone assist?
I've attached the Sub VI, along with a picture of how I'm using it in the main VI.
Thanks
Solved! Go to Solution.
03-05-2013 03:18 PM
Data Flow!
Your while loop where you hide the front panel does not even begin to execute until your subVI has completed. You need to hide the front panel BEFORE you start your subVI. Then when your while loop begins, it will run either one time if the boolean value coming in is true, or run forever if that boolean value is false.
Also, there is no reason to hide the front panel in a loop structure. You are just going to repeatedly hide it as fast as your processor will allow, (then it would only do it once or forever.)
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
03-05-2013 03:24 PM
Your main.vi has a serious dataflow issue. The while loop cannot start until the subVI has finished, at which point the boolean is either true or false and the while loop will either stop immediately, as if it weren't even there or run forever without the posssibility to ever be stopped and the VI needs to be aborted. If this is the subVI you have attached (there is no way to really tell!) it will be true when the subVI completes....
03-05-2013 03:26 PM - edited 03-05-2013 03:28 PM
Personally, I would not hide the main VI, but set the subVI to modal (like a dialog). This way it needs to complete before the main VI can be operated again.
This is the standard and preferred method for these kinds of situations. Don't overcomplicate code by juggling window properties!
03-06-2013 07:12 AM
Thank you all. It's so obvious now...I appreciate the help.