LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for a way to programmatically set the visible portion of the front panel when a subVI opens

Solved!
Go to solution

I am looking for a way to programmatically set the visible portion of the front panel when a subVI opens.  Haven't found any posts that relate, but I'm not sure how to ask the right question.  To be clear, I want to write a helper VI to go through a list of subVIs to make sure the background images are all in the same place when their respective subVIs open.  I hate manually playing with scroll bars before I save each of the VIs...  I'm figuring I need to find the top/left location of the background image (know how to do this already) and then set a VI FP property to  these values or some offset, but I can't find the relevant property. FP:run-timeposition:custom looked promissing, but only affects the location of the window, not the area of the front panel the window is displaying.

0 Kudos
Message 1 of 6
(2,536 Views)

You can use the Pane's Origin Property to set the top left corner.

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

Cool.  Getting closer.  The way I implemented your suggestion affects the subVI only if it is open.  I can use this to do what I'm after, perhaps putting the code into each subVI.  Maybe open all subs, run the helper, and save.    Seems like I'm missing the elegant version...

 

My proof of concept code:

 

Message 3 of 6
(2,530 Views)

You can permanently leave it in there.  If you choose to not open the Vi when called, you can set it up, then use the Methods to open the front panel.

 

If you have OpenG and your background image is the largest, you can use Fit VI Window to Largest Decoration. and it will do it for you.

 

If you want to do it once, you could write one piece of code to iterate through your list or directory of VIs, opening them, applyig what you did below then saving them.  It would prevent some manual labor.  It just depends on what you want to do.

 

If you have a newer version of LabVIEW, you can place you background image as the background image of the Pane (it's no longer a deco).  Set it to be centered, then Adjust the Runtime Position properties to Custom.  Change the Panel Size to be the exact size of your image.  Since the image is resized, the window will automatically be set around the image.  As long as everything fits on the background image, you're set.

0 Kudos
Message 4 of 6
(2,526 Views)
Solution
Accepted by topic author Zwired1

I should have added that the idea of using the background image does NOT change the origin.  So, you still have to be pretty close, as your controls and indicators will not move, just the image.

 

I personally use the OpenG VI and the Front Panel Open Method when I am in your situation.

0 Kudos
Message 5 of 6
(2,523 Views)

For posterity, here's how I finally implemented it. 

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