I couldn’t live without “Resize Front Panel to Largest Decoration”

Posted on Wednesday 28 March 2007

This is the second article of “The OpenG VIs that I couldn’t live without“, a series of articles showing some of my favorite OpenG VIs. In my last article, I talked about the Variant Configuration File VIs and how they allow you to easily write and read configuration parameters to and from files with the magic of variants. Now, we’re going to move to the opposite top of the application stack and look at a couple VIs that helping you to create better user interfaces: “Fit VI Window to Largest Decoration” and “Fit VI Window to Content“. These little VIs are absolutely amazing and save a tremendous amount of time. Here’s how they work.

First, place a frame on the Front Panel, to define the bounds of your Front Panel.

Place Decoration

Next, drop “Fit VI Window to Largest Decoration” on your block diagram.

Place VI

And, finally, run your VI. After you run it, the Front Panel will be resized to fit the frame.

Resized Front Panel

Note: if you want to completely hide the frame, set the border spacing argument of Fit VI Window to Largest Decoration to -2 (it defaults to +2).

Fit VI Window to to Content” is (not shown here) is similar to “Fit VI Window to Largest Decoration“, except that it resizes the Front Panel to fit all visible controls, indicators and decorations.

The reason that these VIs are so useful, is that it is very easy for the Front Panel to be resized during editing tasks. However, by using these VIs, we never have to worry about the size of the front panel, because it will always be sized correctly when the VI is run. Just make sure that these VIs are called, first thing when the VI called.
So, what are you waiting for? Give these great VIs a try! You can obtain them using VI Package Manager (VIPM) simply select the OpenG Application Control Library (the oglib_appcontrol package from within VIPM ), you will find the OpenG Application Control Tools palette in the Functions palette under the OpenG submenu. (See here for a quick guide on how to install OpenG on VIPM.)

7 Comments for 'I couldn’t live without “Resize Front Panel to Largest Decoration”'

    March 29, 2007 | 1:47 am

    You turned on the comments. Cool!

    March 29, 2007 | 4:52 am

    This is really great stuff! I tried it on one VI and it worked like a charm, but another VI has multiple decorations, so I guess I would need to group them all as one?

    Please keep up this series!


    March 29, 2007 | 7:34 am

    Tomi: Yes, I was having trouble with spam, so I turned comments off, temporarily. I am now using a simple challenge+response on the comment form.

    Derek: You have a couple choices: 1) use Fit VI Window to Content to resize the window to all content on the front panel or 2) put a large frame around everything — put the three smaller decorations inside the large frame.



    March 29, 2007 | 8:42 am

    The challenge response looks familiar from expressionflow

    March 29, 2007 | 9:41 am

    Tomi: Yes, I saw the challenge response on your site, so I poked around and found the WP plugin. I hope it works :-)

    April 4, 2007 | 8:23 am

    It seems neither of these worked with one of my VIs that has a tab control as the main interface. Maybe I’m missing something?

    April 4, 2007 | 9:20 am

    Derek: Did you put the decoration outside the tab control? These VIs do not look at anything inside the tab control (on any of its pages). If you’re having issues, try posting a simple example to LAVA or the OpenG discussion forums that demonstrates the problem. -Thanks

Leave a comment



Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.

RSS feed for comments on this post |


Bad Behavior has blocked 778 access attempts in the last 7 days.