02-18-2015 04:20 AM - edited 02-18-2015 04:28 AM
Hello
I've been looking into SubPanels in order to run several VI in one main VI. One thing i wish to achieve is having atleast 2 SubPanels displaying the same VI, BUT, they need to behave as one! Meaning that if I make changes to the VI in one of the SubPanels, the changes also applies to the VI in the other SubPanel.
The following pictures displays my code. The Front Panel consists of a tab control with 2 tabs. The idea here is that I have Control_Panel.vi which is the VI that will be used in several SubPanels, in this case, 1 SubPanel in each tab.
The VI's loaded in the SubPanels have the folllowing functions
The problem here is that if i change the value in one of the Control_Panel.vi VI's, this only applies to that VI, leaving the other Control_Panel.vi with the old values. This results in the display VI's values flickering in between the results calculated from each of the Control_Panel.vi VI's
I want to use the SubPanel solution because that's the way we're working in this project. Is it possible to make the Control_panel.vi VI's behave as one using SubPanels?
EDIT - noticed that some of the pictures got left out. restructured text and added pictures as replies
EDIT 2 - noticed that some text got left out as well. added a paragraph (paragraph 5) explaing the problem
02-18-2015 04:21 AM
02-18-2015 04:21 AM
02-18-2015 05:57 AM
If you have the same VIs loaded into subpanels on all of the tabs, then what is the point of the tab control? Why do you even need these subpanels to be in a tab? Based on the requirements you have given here, I would just move the subpanels out of the tab control.
02-18-2015 06:41 AM - edited 02-18-2015 06:48 AM
It's only Control_Panel.vi that appears in both tabs. if you look closely, you'll see that the other VI's that got loaded are not the same. In tab 1 it's "display", while in tab 2 it's "display2".
Anyhow, whats imprtant is that this is not the final product, but sort of a training for the actual project. Imagine that we will end up having several tabs (5-6), but we only want the Control_Panel.vi in 2 of them, while having other VI's in the same tabs as well (as the pictures illustrate).
That's why i would like to have an understanding in how to implement this.
EDIT
It might be that you refered to the fact that i have Control_Panel.vi in all the tabs, thats a fair point and i mistake by me in this illustration. In our case, we want the Control_Panel.vi just to be visible in some of the cases, not all, so it's important that the VI is not visible in some situations as well
02-18-2015 06:49 AM
Then I highly recommend learning User Events so that you can pass the data between the clones of the VI.
02-18-2015 07:04 AM
I'll take a look at that, but i guess that means I will have to change this event handler if any changes are done to the Control_Panel.vi?
One of the reasons I want my original questions to work is because it will probably ensure that all SubPanels with the same VI will behave the same, even if that perticular VI have been expanded or altered. Because it just loads the entire VI and tells the VI's to work as one (this is what i hope is possible to do with some SubPanel options).
02-18-2015 08:35 AM
I only guessing...
What if you only opened the Control_Panel.vi once but fed it's VI Ref into the two sub panel's "Insert VI" method?
You could only have ONE control sub-panel and have it "float" above the tab control (not in or on).
This is offten used to have one Stop button appear on all tabs without to put a Stop button on every tab.
02-18-2015 09:07 AM
@Omar_II wrote:
I only guessing...
What if you only opened the Control_Panel.vi once but fed it's VI Ref into the two sub panel's "Insert VI" method?
You could only have ONE control sub-panel and have it "float" above the tab control (not in or on).
This is offten used to have one Stop button appear on all tabs without to put a Stop button on every tab.
I'd guess since they only want it to show for some of the tabs, this wouldn't be their preferable option.
02-18-2015 10:47 AM
You can't have the same Front Panel in two subpanels at once, but you can use the Tab Control's "Value Changed" event to remove the FP from the now-hidden subpanel and put it in the now-showing subpanel.