06-06-2013 08:07 PM
Hello,
My goal is to trigger an event in the which every VI is loaded into to the main subpanel whenever a boolean is pressed in the left subpanel VI.
I have opened each VI staticly and abort them as soon as another tab is opened (Test Setup, Instrument Configuration, analysis, etc.) from the top panel.
I have tried passing the a boolean reference via a functional global variable to the the main vi in the right subpanel and it does not work.
I am thinking passing the information through a user event or queue, however I need it to only trigger when the button is pressed in the left panel.
Maybe just removing the left panel and having the buttons loaded with the main vi in the main subpanel may work or is using the two subpanels possible?
Thank you.
06-07-2013 12:57 AM - edited 06-07-2013 12:58 AM
Hope this will help. Let me know if you need any help
06-07-2013 09:51 AM
Hey, thanks Ranjeet for the response, I am still working through it. I am confused though.
Are both pieces of code located in the VI in the main subpanel? I am not entirely sure how the user menu selection would send the signal to save the configuration values.
06-07-2013 10:34 AM
Ok, using the call by reference .VIs I used an event structure in the menu subVI where I call by static reference the main panel subvi and insert the values into my functional global variable. I did, although do I need to call the functional global through the call by reference, I think I'm doing redundant code there.
Also, I am not sure why but I had to make the static VI a strictly typed reference, why?
I did not want to drop the subVI in on its own as it is already running.
Does this make sense?
06-07-2013 01:19 PM
You might want to look into the MVC (Model View Controller) design pattern. This is where you maintain a encapsulated store of 'Model' data (any data you need to share) and provide an interface to the Model for
reading and writing parts or the whole Model. Any View (Top Level VI) that has a UI changes will write an update of that data to the Model, the Model will in turn Publish this data in the form of a User Event which any GUI's can subscribe (Wire the Event reference to a dynamic user event input on its event loop) to. It really not as hard as it sounds and will give you great flexibility and extensibility in your design. The Store for the model could be as simple as a FGV or singleton class data.
06-07-2013 02:12 PM
Hmm loooks interesting, I'm taking a look at it right now and at the very least I understand how to use events with queues much more clearly. Thanks for the suggestion sachsm.
I keep going deeper into the rabbit hole everytime I try and optimize/solve my design.