11-17-2011 02:26 PM
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.
Solved! Go to Solution.
11-17-2011 02:32 PM
You can use the Pane's Origin Property to set the top left corner.
11-17-2011 02:45 PM
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:
11-17-2011 02:55 PM
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.
11-17-2011 03:10 PM
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.
11-18-2011 12:23 PM
For posterity, here's how I finally implemented it.