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.
Next, drop “Fit VI Window to Largest Decoration” on your block diagram.
And, finally, run your VI. After you run it, the Front Panel will be resized to fit the frame.
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.)