07-23-2007 03:01 PM - edited 07-23-2007 03:01 PM
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
07-23-2007 03:19 PM
Good Nugget tst.
I was just using that very functionality yesterday while designing a GUI and making it fit in 1024 X 768.
Ben
07-23-2007 03:31 PM
07-23-2007 11:21 PM
07-24-2007 02:25 AM
07-25-2007 06:57 PM
07-29-2007 08:15 AM
Excellent nugget tst!
07-31-2007 02:22 PM
08-15-2007 10:31 AM
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
08-16-2007 12:01 PM