LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Community Nugget, 07/23/2007

If you're like me, you probably failed to notice the four buttons found in the toolbar of each VI, and even if you did notice them, you probably only used some of them.

I'm not going to go over all of them, but for a quick recap, they are:

Align allows aligning (surprise) your objects so that they are all positioned in straight lines.

Distribute allows you to set the spaces between the selected objects.

Resize allows you to control the sizes of selected objects relative to each other.

Reorder allows grouping, locking and changing the Z order of objects (that is, which objects are "on top").

Today's nugget is mainly about calling attention to these, but it also focuses a bit on the third button - the resize button.
By default, LabVIEW has the FP elements snap to the grid when you move and resize them, so they're all nicely aligned, but I don't like that. It affects my ability to control my GUI, so I turn it off. This means that I need another way to align my FP objects and that's where those buttons come in.

For example, if I was to click the Maximum Width button, both controls would become the same width as the wider one:

The other options are essentially the same. The one which stands out is the Set Width and Height button... which opens a dialog (a VI, actually) which allows setting an exact size to each of your objects:

One example of where this is useful is if you want to design a UI to be at a lower resolution than the one you are working on. You can simply drop a decoration on the front panel, resize it to the size you want and use that as a guide to move your objects.

Note - one thing you should be careful about is labels and captions. They are included in the control size and failing to account for them can mess up your layout.

Another note - this also applies to the block diagram and is a useful method for aligning your different elements, which is important for clean code.

For a list of past nuggets, see here.
If you want to write a nugget yourself, see here.

Message Edited by tst on 07-23-2007 11:03 PM


___________________
Try to take over the world!
Download All
Message 1 of 15
(11,394 Views)

Good Nugget tst.

I was just using that very functionality yesterday while designing a GUI and making it fit in 1024 X 768.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 15
(11,369 Views)
Nice nugget, tst.
Lucky Ben. Works with LabVIEW.  I am currently working on some C code.
Hopefully going back to LabVIEW in a few days.
Have a nice day, Guenter
Message 3 of 15
(11,359 Views)
I was in the Navy, but now that I've used LabVIEW I never want to go back to "C".......Smiley Very Happy
Message 4 of 15
(11,309 Views)
Hi tst,

nicely done.

It seems I have to work more intensively with LV8+ as I didn't notice the 'Set Width & Height' button until now...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 15
(11,262 Views)
Good nugget I use these with every GUI on a daily basis.  I few other points I like for proper allignment I usually show the captions and never the Lables on a GUI as to decouple the varaible from the interface and I like to unselect the size to text then apply some common width like 100 or 200.  This makes it easier to align text and controls at once. Also the align and distribute are avaliable for cleaning up the block diagram so I encourage all to use this for code readability.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 6 of 15
(11,065 Views)

Excellent nugget tst!

 

Message 7 of 15
(10,943 Views)
Hey tst,
 
Very well done on the nugget. 
 
When writing VIs with numerous indicators it is absolutely necessary to take advantage of the align button.  That is if you want to make a vi that looks nice Smiley Tongue
Message 8 of 15
(10,837 Views)

I have used the Reorder button in the past.  Does anyone know of a way to find out what 'order' things are in?  For instance, say you have three (or more) FP objects that are one on top of the other or overlapping (can have transparent parts).  Is there any way to control the 'layering' of these objects other than cycling each one through 'Move Forward' and 'Move Backward' until you luck onto the correct order?

 

Roy

Message 9 of 15
(10,587 Views)
Do you mean is there a way to programmatically find the order of things? I do not know of any way to do that. I just looked through the property nodes but nothing caught my eye.
Nick R
NI
0 Kudos
Message 10 of 15
(10,518 Views)