LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot add button to a sub panel

Solved!
Go to solution

Hello everybody. This should be easy, but it has me stumped. Using LabVIEW 2018. I have a sub panel containing a number of controls, and I have added another button (with the text "Altimeter" on it) to the sub panel, but it isn't behaving like the other buttons in the panel. When editing the front panel, if I select one of the existing buttons ("Light 1") then I see this:

RichardE_0-1720520062283.png

Note that the sub panel and the other controls have a dotted blue and yellow line around them, but the "Altimeter" button does not. If I select the "Altimeter" button then I see this:

RichardE_1-1720520188158.png

Only the "Altimeter" button has the dotted line around it.

If I attempt to resize the sub panel, this happens:

RichardE_2-1720520289233.png

All the other controls resize along with the sub-panel, but the "Altimeter" button just stays put.

Also, when I run the program, the "Altimeter" button suddenly jumps to another location within the panel, like this:

RichardE_3-1720520574801.png

It seems to me that the "Altimeter" button isn't really inside the sub panel at all.

What is it I need to do to make it a control inside the sub panel that behaves just like the other buttons?

Any help appreciated.

 

 

0 Kudos
Message 1 of 15
(752 Views)

Hi Richard,

 


@RichardE wrote:

When editing the front panel, if I select one of the existing buttons ("Light 1") then I see this:

RichardE_0-1720520062283.png

Note that the sub panel and the other controls have a dotted blue and yellow line around them, but the "Altimeter" button does not.


It seems those other controls (and decorations) are grouped. You could ungroup them and create a new group with your additional button included. (I never needed to group items on the frontpanel, so ungrouping would be sufficient for me...)

 


@RichardE wrote:

Also, when I run the program, the "Altimeter" button suddenly jumps to another location within the panel, like this:


Is the origin of the subpanel VI frontpanel in the upper left corner of the frontpanel view?

I have the habit of setting the pane origin (coordinate [0, 0]) right there - mostly because it avoids lots of hassle with subpanel VIs...

 

I guess you would get better/more help when you would attach real code instead of images of code...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 15
(727 Views)

Look at that again.

 

The Altimiter Button is actually floating over the subpanel container and part of the calling vi.

 

Richard, you need to modify the Front panel of the vi inserted into the subpanel not the vi the subpanel is on

 

That is if that really is a subpanel container.  That cannot be proven without at least a code image of the BD.  you could right-click the object and show terminal to get the right area of the code.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 15
(705 Views)

Thanks for that. I did wonder if those controls were in a group, but couldn't figure out how to group and ungroup. After you told me, I managed to ungroup them and then tried running again but the problem remained. Then I tried grouping all the original controls plus the new one, but again no luck. Then I thought about getting rid of the sub-panel altogether, but then things really started to fall apart, so I went back to an earlier working version.

 

I am fairly sure that the sub-panel is just there as a form of decoration. I don't believe that it is intended as a container for one of a number of VIs which, as I understand it, is often the purpose of a sub-panel. The buttons and indicators you can see are not contained within a sub-VI. The way the code works at the moment is by using property nodes to write false to the Visible property of all the controls that need to be hidden, and to write true to all the controls that need to be shown.

 

I would upload the code, but it is an absolutely enormous VI with references to the relevant controls scattered around all over the place, so I'm not sure it would be much help, and I'm not sure I should since it is commercial software. The code goes back a long way. A company which became part of the same group wrote it decades ago, and then we inherited the code. A chap who was with us for a few years made the code easier to follow by modularising it (the original conatined no sub-VIs at all), but he left, and it has landed on my desk. I have used LabView before, but am by no means an expert. If I can't stop that button jumping around all over the place then I may try and isolate the code in a simpler project.

 

Thanks again.

0 Kudos
Message 4 of 15
(696 Views)

Hi Richard,

 


@RichardE wrote:

I am fairly sure that the sub-panel is just there as a form of decoration. I don't believe that it is intended as a container for one of a number of VIs which, as I understand it, is often the purpose of a sub-panel. The buttons and indicators you can see are not contained within a sub-VI.


This doesn't make sense!

  • When there is a subpanel then its only purpose is to show the frontpanel of other (sub)VIs.
  • On the other hand you write the frontpanel elements in your images are not placed on the frontpanel of a subVI...

So this asks for "attach code, not images of code"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 15
(688 Views)

I don't think you understand what a sub-Panel is.  What goes into a sub-Panel is a running VI, whose Front Panel (with Controls and indicators) "appears" in the sub-Panel, allowing you to push, say, a "Stop Me" button on the sub-Panel VI and have it stop that VI from running (without having any effect on your Top-Level VI, which has its own, separate, "Stop" button).  

 

When you create a sub-Panel, you'll get something on your Block Diagram with the description "Sub Panel" (or whatever you name your sub-Panel) that says "Insert VI", asking for a VI Reference to the VI that you want to run wired into it.  This puts the Front Panel of the VI "into" the sub-Panel, so you can interact with its Controls and Indicators as though they were on the Front Panel of your "Main" routine.  Now all you need to do is have your Main run the VI (perhaps by using Start Asynchronous Call) -- it should start to run, show you whatever you programmed it to show you, and stop when you push its "Stop Me" button.  It will continue to be "visible in the Window" until you "Remove VI".

 

Bob Schor  

0 Kudos
Message 6 of 15
(674 Views)

@GerdW wrote:

Hi Richard,

 


@RichardE wrote:

I am fairly sure that the sub-panel is just there as a form of decoration. I don't believe that it is intended as a container for one of a number of VIs which, as I understand it, is often the purpose of a sub-panel. The buttons and indicators you can see are not contained within a sub-VI.


This doesn't make sense!

  • When there is a subpanel then its only purpose is to show the frontpanel of other (sub)VIs.
  • On the other hand you write the frontpanel elements in your images are not placed on the frontpanel of a subVI...

So this asks for "attach code, not images of code"!


OK we can likely assume that what your image shows is NOT a subpanel container.   

 

That leaves us with the question of exactly what the object is!  It could be some grouped controls in a decoration.   It might be a cluster.  We just cannot tell without seeing wherever is on the BD. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 15
(663 Views)

@RichardE wrote:

I would upload the code, but it is an absolutely enormous VI with references to the relevant controls scattered around all over the place, so I'm not sure it would be much help, and I'm not sure I should since it is commercial software. [...] If I can't stop that button jumping around all over the place then I may try and isolate the code in a simpler project.

 

Thanks again.


- What do you see if you right click a control and select 'find->terminal'? A boolean terminal a cluster terminal?

- Can you select the controls, or the whole area around the controls, on the front panel and copy them to a new VI and see what is on the block diagram?

0 Kudos
Message 8 of 15
(608 Views)

Thanks for that.

When you say that the only purpose of a sub-panel is to contain the front panel of a sub-VI I think this is certainly the intention, but this isn't how it is being used here. It really is just there for its visual appearance. My mistake is thinking that the buttons within the outline of the sub-panel are in some way contained within the panel (as they would be in a Windows Forms application). They are not. In fact in trying to understand how this works I wrote a little test program to try and reproduce the problem. See attached. This has no sub-VI associated with the sub-panel. I remember that when I added the sub-panel a terminal did appear on the wiring diagram, which if left unwired did prevent the VI building, but once I deleted this terminal the visual part of the sub-panel remained as a purely decorative element.

0 Kudos
Message 9 of 15
(585 Views)
Solution
Accepted by topic author RichardE

Yes. If I select any of the buttons and do a find terminal what I see is a boolean terminal. It is not part of a sub-VI. I realise this is probably a strange way to use sub-panels, but I have to work with what I have.

 

Anyway, I seem to have solved the problem, and it is my mistake. The button jumping around was a huge red herring. I was confusing the button that turned on the power to the altimeter with the indicator that displays the altitude. There is a sub-VI buried in the code that (amongst other things) positions the indicators and buttons so that they are evenly spaced horizontally. I had wired the power button into this VI instead of the indicator so that when the code ran it grabbed the button and moved it to where the indicator should have been positioned. I have untangled all this now and it works as expected.

 

Probably should not be using sub-panels in this way, but it works, so I am going to leave it.

 

Thanks for all your help.

Message 10 of 15
(581 Views)