LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resize VI in Subpanel when main VI is resized

This seems like it should have a simple answer, but I can't seem to find it. I have a VI that contains 12 subpanels each within a seperate pane. Each of those subpanels loads a VI. When I resize the main VI, I want all the VIs in the subpanels to resize as well. I've set the subpanel to fit the pane.

 

I tried programmatically setting the VI front panel bounds to match the subpanel when the main VI's resize event fires. I get an error stating that front panels bounds cannot be set when that VI is in a subpanel.

 

Any ideas?

0 Kudos
Message 1 of 6
(6,609 Views)

In your resize event, maybe you can unload the subpanel, resize it, then reload on mouse up. It might be disturbing not to see the VI in the subpanel while resizing. Just a thought and there is probably a better way. If there is then someone will definately reply.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 6
(6,603 Views)

The vi in a subpanel will fire it's own <This VI>: Panel Resize event if the subpanel is resized.

 

have you tried reacting to the panel resize in each of the loaded VIs?

 

worth noting: IIRC it doesn't do anything to modify the panel or window bounds of the VI if it's loaded in a subpanel.  What you need to do is to read the pane size and origin and fit what's on the subpanel VI FP to that.

-Barrett
CLD
0 Kudos
Message 3 of 6
(6,598 Views)

The answer was even simpiler than I imagined. I just didn't have the option to "scale all object with front panel" (under VI Properties>Window Size) selected in the VIs that I load. Once I did that, they all scaled as expected.

Message 4 of 6
(6,589 Views)

@blawson wrote:

The vi in a subpanel will fire it's own <This VI>: Panel Resize event if the subpanel is resized.


My tests show this not to be true.  Attached is a Parent and Child VI.  Run the child and resize the window.  You will see the indicator "NewBnds" change as the window is resized.  Now run Parent.  It will load the Child VI into a sub panel that is set to fit to the pane size.  Now if you resize the Parent window, it will resize the subpanel, and the Child Vi will change in size.  However the "NewBnds" value does not change, meaning the <This VI : > : Panel Resize event is not being fired in the Child VI, when a subpanel is resized in a Parent VI.

 

My question is, how do I get notified in the Child VI when a subpanel is resized that the Child has been inserted into?

Message 5 of 6
(6,429 Views)

Cross-reply:

 

http://lavag.org/topic/16483-subpanel-resize-event/#entry100860

 

If you use the Pane Size events instead, they will fire in the SubPanel VI.

Message 6 of 6
(6,407 Views)