07-19-2013 11:11 AM
Hi,
I am developing an application that needs to be run on multiple computers that have different screen resolutions. I would like to make the front panel of my program scale according to the current screen size. I saw two check boxes in the File>VI Properties>Window Size dialog box: 1. Maintain proportions of window for different monitor resolutions, and 2. Scale all objects on the front panel as the window resizes. However, there are still two issues that come up when both of these features are turned on. First, text boxes do not scale with everything else. When I run the program on a computer with smaller screen resolution (1366x768), the text is still the same size as it was on the computer I edited it on (1920x1080). This results in the content of the text boxes being larger than the boxes they are in and therefore unreadable. The second isssue is not as crucial, but I am curious if there is a way to resolve it. When using the "Scale all objects on the front panel as window resizes" feature, if I expand the window everything scales correctly; however, when I put the window back to its original size many of the buttons have shifted slightly.
Does anyone have any suggestions? Currently, the best thing I can think of is to make another version of the program for smaller screens, make a new main VI to detect screen resolution, and load the VI that has the correct size.
Thanks.
07-19-2013 12:24 PM
You may want to try out the Front Panel Layout Tool, which was created to address the issue of creating a single UI for different screen resolutions. It allows you to create multiple "layout" files for a single VI, then you can programmatically load one of the layouts when the VI runs. Each layout stores the position and size information of all items on the front panel. You can install the tool through VI Package Manager, then take a look at the example projects in <LabVIEW 20xx>\examples\Front Panel Layout\.
The issue you've been seeing with shifted buttons when you use "Scale All Objects with Panel" is a symptom of the fact that the LabVIEW UI is pixel based. The position and size information of eveything on the front panel is stored as integer values. When you shrink the front panel, some of the size values get rounded off to the nearest whole integer value. Then, when you scale the panel back up to a larger size, the round off errors are amplified. Repeating this several times can result in a highly distorted UI. The Front Panel Layout Tool avoids this problem, because each resize is relative to the values stored in the layout file, instead of the values from the previous resize event. I'd be curious to see if you have any feedback on the tool.
Chris M
07-19-2013 01:43 PM
Thanks! This seems to be what I am looking for. I will incorporate it into my program and post some feedback about how things turn out.
07-19-2013 03:52 PM
Figuring out how to set this tool up in my VI is alittle overwhelming. Any chance there is a tutorial?
07-22-2013 03:18 PM - edited 07-22-2013 03:21 PM
@lbvw wrote:
Figuring out how to set this tool up in my VI is alittle overwhelming. Any chance there is a tutorial?
Right now, the documentation for this tool is a little sparse. I hope to publish a "how to" document on it shortly. In the mean time, here are some pointers for getting started:
Let me know if you have any questions.