From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert part of FP into a subpanel

I have a module (VI) that can be either run in subpanel or independently.

The module has couple of sections distinguished by horizontal splitters.

 

What I would like to achieve is to have only a selected pane mounted into subpanel, not the entire FP of a VI.

Do you have any idea if that's possible?

 

Below is the screen shot of the VI with subpanel.

I would like to mount only yellow pane from my module (VI).

pitol_0-1675254859347.png

 

Attached you can find an example of how it works right now.

 



0 Kudos
Message 1 of 11
(1,393 Views)

The part of the VI in a subPanel that shows is always limited to the size of the SubPanel.

 

So by setting the VI's origin and the SubPanel size, you have all the tools you need.

 

The problem here is probably that your VI auto sizes (the splitters) to the SubPanel bound, and that makes it hard to do what you want.

 

I'd probably make the yellow part a SubVI in a SubPanel, so I can choose in which SubPanel the yellow part shows.

 

A completely different approach is to use two SubPanels. The VI with the splitters shows in a stub VI's SubPanel with a fixed size, and you show the stub in your original SubPanel. This would allow you full control over the VI's size, by controlling the size of the SubPanel in the stub. You'd resize the stub's SubPanel to make the yellow part fit the original's SubPanel.

0 Kudos
Message 2 of 11
(1,384 Views)

wiebe@CARYA wrote:

The part of the VI in a subPanel that shows is always limited to the size of the SubPanel.

 

So by setting the VI's origin and the SubPanel size, you have all the tools you need.

 

We tried with the origin position or even manipulating the splitters position if the VI is run in subpanel but without success.

We managed to achieve some progress but not enough for our needs 🙂

 


wiebe@CARYA wrote:

I'd probably make the yellow part a SubVI in a SubPanel, so I can choose in which SubPanel the yellow part shows.

 

A completely different approach is to use two SubPanels. The VI with the splitters shows in a stub VI's SubPanel with a fixed size, and you show the stub in your original SubPanel. This would allow you full control over the VI's size, by controlling the size of the SubPanel in the stub. You'd resize the stub's SubPanel to make the yellow part fit the original's SubPanel.


That sounds like a lot of overhead work...

 

 



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

@pitol wrote:

 


wiebe@CARYA wrote:

I'd probably make the yellow part a SubVI in a SubPanel, so I can choose in which SubPanel the yellow part shows.

 

A completely different approach is to use two SubPanels. The VI with the splitters shows in a stub VI's SubPanel with a fixed size, and you show the stub in your original SubPanel. This would allow you full control over the VI's size, by controlling the size of the SubPanel in the stub. You'd resize the stub's SubPanel to make the yellow part fit the original's SubPanel.


That sounds like a lot of overhead work...


The first solution wouldn't have been much overhead work if you designed it like that from the start. To refactor it afterwards could be some work, to a lot of work, depending on the VI you're refactoring. This solution sounds more correct to me, but moving VIs around SubPanels can be tricky.

 

The second solution isn't that much work. It might take some time to make it work, esp. if you're new to this kind of solution. Only 1 VI with little in it is added.

 

You can't escape some math \ coordinate fiddling though. All coordinates should somehow magically align properly to get the desired effect. So there's some property node magic involved. Not much, but it needs to be right.

0 Kudos
Message 4 of 11
(1,333 Views)

I played around with the splitter position and managed to hide most of the non-yellow panes. 

ZYOng_0-1675263021653.png

 

0 Kudos
Message 5 of 11
(1,331 Views)

@pitol wrote:

wiebe@CARYA wrote:

The part of the VI in a subPanel that shows is always limited to the size of the SubPanel.

 

So by setting the VI's origin and the SubPanel size, you have all the tools you need.

 

We tried with the origin position or even manipulating the splitters position if the VI is run in subpanel but without success.

We managed to achieve some progress but not enough for our needs 🙂


Those splitters will stay in the visible part of the front panel, and that what is visible is the SubPanel.

 

So you need to somehow get rid of the splitters to get more flexibility, or do the 2 SubPanel trick.

 

I don't see good alternatives, esp. none that's easier...

0 Kudos
Message 6 of 11
(1,330 Views)

@ZYOng wrote:

I played around with the splitter position and managed to hide most of the non-yellow panes. 

ZYOng_0-1675263021653.png

 


I guess you can cover the green splitters with a decoration, and make a fake frame around the SubPanel.

 

As a side effect, you  probably loose the original splitter positions, which might be inconvenient (or not).

0 Kudos
Message 7 of 11
(1,328 Views)

When you open a (running) VI in a sub-Panel, it shows the Front Panel of the VI as it is when it is running.  So there are a few solutions to your problem of "showing only the yellow part":

  1. Open your VI and adjust the boundaries of the Front Panel so it just shows the Yellow part.  Save the VI in this state, where "what you see is what you (want to) get".  When you run the VI in the Front Panel, you'll see the Yellow part.
  2. Do what I do.  Open VIPM (a.k.a The LabVIEW Tools Network) and download OpenG Toolkit.  This Toolkit has been around for close to two decades (maybe longer?), and some of the ideas here have made it into LabVIEW.  What you really want is the OpenG Application Control Library, which has a function called "Fit VI Window to Largest Dec" (Dec = Decoration).  On your VI's Front Panel, put a Decoration (I use a Flat Box, and make the center Transparent, if necessary) where you want the edges to be.  In your VI, run "Fit VI Window to Largest Dec" when the VI starts, and what you'll see (in the sub-Panel) should be the Yellow part.  

Bob Schor

0 Kudos
Message 8 of 11
(1,280 Views)

@Bob_Schor wrote:

When you open a (running) VI in a sub-Panel, it shows the Front Panel of the VI as it is when it is running.  So there are a few solutions to your problem of "showing only the yellow part":


I'm pretty sure (I actually tested this for a change 🙂) the VI gets a panel resize event (and successive pane resize events) when it's inserted into a SubPanel. This will automatically move splitters with the SubPanel's rectangle as new panel bounds. Fit to pane controls will also resize, and I don't think there's much you can do about it (except turn off fit to pane).

0 Kudos
Message 9 of 11
(1,269 Views)

wiebe@CARYA wrote:

@Bob_Schor wrote:

When you open a (running) VI in a sub-Panel, it shows the Front Panel of the VI as it is when it is running.  So there are a few solutions to your problem of "showing only the yellow part":


I'm pretty sure (I actually tested this for a change 🙂) the VI gets a panel resize event (and successive pane resize events) when it's inserted into a SubPanel. This will automatically move splitters with the SubPanel's rectangle as new panel bounds. Fit to pane controls will also resize, and I don't think there's much you can do about it (except turn off fit to pane).


I'm not 100% certain I know what @wiebe means (I'm quite sure, though, he's probably correct).  I remembered, however, that there was a step I forgot to include:  When I want to put a Front Panel in a sub-Panel, I measure the width and height of the Decoration, and the width and height of the sub-Panel, and "manually" resize them so they "fit" (i.e. are the same size).  Actually, I don't really "measure" -- I take the VI with the sub-Panel and the VI with the "Front Panel + Decoration" that will be put into the sub-Panel and slide the second VI's Front Panel "on top of" the one with the sub-Panel to make sure the sizes are the same.  I often size the sub-Panel and Decoration so they are an integer number of "grid blocks", which make the comparison easier.  A little bit of work, but the results are very nice ...

 

Bob Schor

0 Kudos
Message 10 of 11
(1,257 Views)