PaulL Posted March 17, 2012 Report Share Posted March 17, 2012 OK, I have been struggling with this all day. I don't like the solutions I have found yet. Prior to today I had a top-level view (call it A) and it puts VIs (B0...n) in subpanels (and runs them dynamically). A has references to the B VIs, so when the user closed A it just aborted all the B VIs. That's a bit brute force, but it worked just fine. Today, I decided to put C in a subpanel of one of the B VIs. Starting up is not a problem and the code runs great, but shutting down the same way doesn't work since A doesn't have a reference to C (currently), so C continues running. That's not the plan. So, we could: Have B pass C's reference to A and A can shut down all parties. Have A tell B to shut down and B tell C to shut down. (Conceptually I like this much better.) Of course this means the abort mechanism won't work. Constraints: No ugliness! This means no polling (super yuck!). This should fit within the existing event structure approach. (So we can rule out global variables or single-process shared variables.) At each level the views must be able to operate stand-alone. For instance, B must be able to run without A (which was true before we added C, by the way). I have tried: Having each parent fire the FrontPanel close event on its children (FrontPanelClose? is not available via reference), but this doesn't work for subpanels (as I eventually found mentioned in other threads). Using a signaling event on a stopVI button for each VI. This works (or at least seemed to in a brief test) but it requires putting a control for this purpose on each VI. I don't like this because if I even double click on the terminal (even if the button is invisible) I have to spend time carefully putting the front panel back at its origin. More ugliness. Other ideas: We could have B pass C's reference to A, as stated above, but creating and then reading an indicator for this on B, while it would work, is quite messy. Creating a user event in A and handing this off to B. This will work but it requires some care to meet the second constraint, and it again requires adding control to each VI (or passing the event reference in some other fashion, but that doesn't provide any advantages over the control signalling method already tried). Use networked shared variables. I know this will work and we already have the mechanism in place. It is super-easy for us to implement. Moreover, we don't need to add any controls. On the other hand, in this particular circumstance I'd kind of like to avoid this because I don't really want to deploy any more libraries on the host computer. (Maybe I shouldn't worry about that.) Suggestions? Quote Link to comment
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.