Felipe Posted September 7, 2016 Report Share Posted September 7, 2016 (edited) Hello all, I need your help to understand how to connect a GUI with main loop in the parent VI. Please think in the following situation. I have a main VI which calls asynchronously a subVI containing the GUI, which basically it have to send commands and parameters back to the main loop. The only way I know to send back data is by using in the main loop an invoke node configured to get/set the value of a control in the GUI control panel. But... what if I want to send data which is not in a control or indicator, but it is the result of a calculation/decision (such a command), there is a way to return data which is not shown in the GUI?? (without adding a hidden control in the front panel...) I have spend quite a lot of time browsing for the solution, but I think I'm not using the correct keywords because now I'm more confused that at the beginning. thanks! felipe.- Edited September 7, 2016 by Felipe Quote Link to comment
Tim_S Posted September 7, 2016 Report Share Posted September 7, 2016 Try searching model view controller (MVC). You are trying to get two loops to communicate, which there are lots of examples of (and even more ways to implement). Quote Link to comment
ShaunR Posted September 7, 2016 Report Share Posted September 7, 2016 (edited) 50 minutes ago, Tim_S said: Try searching model view controller (MVC). You are trying to get two loops to communicate, which there are lots of examples of (and even more ways to implement). Or the Muddled Verbose Confuser pattern, as I call it. That must be the worst pattern ever invented. No-one can agree what should be in what bits. No-one ever puts the right bits in the right place after they have argued about it and everyone ends up with MC, MV or one of the other letter combinations (take your pick). Then every single one of the gazillion files only has one of 3 names (controller, view and model) In theory it's great. In practice it's foot shooting with a bazooka. 1 hour ago, Felipe said: which basically it have to send commands and parameters back to the main loop. Look at the "Event" examples that ship with LabVIEW. In your GUI you probably already have an event structure so create a "User Event" and get your GUI to register for it. Edited September 7, 2016 by ShaunR 1 Quote Link to comment
Tim_S Posted September 7, 2016 Report Share Posted September 7, 2016 39 minutes ago, ShaunR said: Or the Muddled Verbose Confuser pattern, as I call it. That must be the worst pattern ever invented. No-one can agree what should be in what bits. No-one ever puts the right bits in the right place after they have argued about it and everyone ends up with MC, MV or one of the other letter combinations (take your pick). Then every single one of the gazillion files only has one of 3 names (controller, view and model) In theory it's great. In practice it's foot shooting with a bazooka. Any chance you have a strong opinion on it? 1 Quote Link to comment
ShaunR Posted September 7, 2016 Report Share Posted September 7, 2016 42 minutes ago, Tim_S said: Any chance you have a strong opinion on it? I don't have opinions. I have mental scars from fixing other peoples code. Quote Link to comment
Tim_S Posted September 7, 2016 Report Share Posted September 7, 2016 22 minutes ago, ShaunR said: I don't have opinions. I have mental scars from fixing other peoples code. Suppose that's better than having mental scars from fixing your own code. 1 Quote Link to comment
ShaunR Posted September 7, 2016 Report Share Posted September 7, 2016 44 minutes ago, Tim_S said: Suppose that's better than having mental scars from fixing your own code. Software is like a fart. Yours is ok but everyone elses' stinks. 1 Quote Link to comment
drjdpowell Posted September 7, 2016 Report Share Posted September 7, 2016 4 hours ago, Felipe said: The only way I know to send back data is by using in the main loop an invoke node configured to get/set the value of a control in the GUI control panel. Spend some time learning about Queues and User Events, and the concept of a loop handling messages. Forget about Get/Set invoke nodes. Quote Link to comment
eberaud Posted September 7, 2016 Report Share Posted September 7, 2016 If most of what you read in that thread is new to you, start with queues. That's really a must-know in LabVIEW, on which many more sophisticated patterns are based. Quote Link to comment
Felipe Posted September 9, 2016 Author Report Share Posted September 9, 2016 Hello and thanks!. I'm familiar with user events and I start trying with queues. Now I'm more clear. Thanks for your answers!! best, Felipe.- Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.