LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Same VI in multiple SubPanels that behaves as one

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

  • Control_Panel.vi: Adds the values in "Numeric" and "Numeric 2" and writes the results to a shared variable called "result"
  • display.vi: Writes the value from the the shared variable "result" to "Numeric 2"
  • display2.vi: Reads the value from the shared variable "result", multiplies it with 2 and writes the result to "Numeric"

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

 

FrontPanel1.PNG

 

 

0 Kudos
Message 1 of 11
(3,243 Views)

FrontPanel2.PNG

0 Kudos
Message 2 of 11
(3,241 Views)

BlockDiagram.PNG

0 Kudos
Message 3 of 11
(3,240 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 11
(3,219 Views)

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

0 Kudos
Message 5 of 11
(3,208 Views)

Then I highly recommend learning User Events so that you can pass the data between the clones of the VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 11
(3,202 Views)

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).

0 Kudos
Message 7 of 11
(3,195 Views)

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. 

Omar
0 Kudos
Message 8 of 11
(3,179 Views)

@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.

0 Kudos
Message 9 of 11
(3,173 Views)

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.   

0 Kudos
Message 10 of 11
(3,163 Views)