Useful Tips


As you do more and more programming in LabVIEW, you'll find some of these shortcuts very useful for putting together your VI more quickly. Look over all of these, and refer back to them later as reminders; you're sure to find some that will make you say, "I wish I'd known that!"

Keyboard Shortcuts

Many LabVIEW menu options have keyboard shortcuts. For example, to create a new front panel window, you can select the New VI option from the File menu or press the keyboard equivalent: <control-N> (for Windows), <meta-N> (for Linux), or <command-N> (for Mac OS X).

In general, the keyboard auxiliary keys, <ctrl> on Windows or <command> on Mac OS X, have the equivalent of <alt> key for Linux.


LabVIEW allows you to edit the menu shortcuts, modifying existing shortcut key combinations and assigning shortcut key combinations to those that do not have them by default. You can edit the menu shortcuts from the Tools>>Options menu in the Menu Shortcuts section.


Examples

Glance through the examples that ship in LabVIEW using the NI Example Finder, as discussed in Chapter 1, "What in the World Is LabVIEW?" You can use these programs as is or modify them to suit your application. You can open the NI Example Finder by selecting Find Examples . . . from the Help menu.

Changing Tools

When LabVIEW is in edit mode (and the Lock Automatic Tool Selection LabVIEW preferences option is not enabled, as described in Chapter 3, "The LabVIEW Environment"), pressing <tab> toggles through the tools. If the front panel is active, LabVIEW rotates from the Operating tool to the Positioning tool to the Labeling tool to the Color tool. If the block diagram is active, LabVIEW toggles through the tools in the same order, except that it selects the Wiring tool instead of the Color tool.

You can also press the spacebar to alternate between the Operating and Positioning tools in the front panel, and the Wiring and Positioning tools in the block diagram.

Changing the Direction of a Wire

Pressing the spacebar while you wire changes the direction from which the current wire branch leaves the last tack point. Thus, if you accidentally move horizontally from a tack point but want the wire to move down initially, pressing the spacebar changes the initial orientation from horizontal to vertical.

Canceling a Wiring Operation

To delete a wire as you are wiring, simply press the <Esc> key. Alternately, under Windows and Linux, click the right mouse button. On Mac OS X, wire off the screen and click.

Removing the Last Tack Point

Clicking while wiring tacks a wire down. <Shift>-clicking while wiring removes the last tack point, and <Shift>-clicking again removes the next-to-the-last tack point. If the last tack point is the terminal, <Shift>-clicking removes the wire.

Inserting an Object into Existing Wires

You can insert an object, such as an arithmetic or logic function, into an existing wiring scheme without breaking the wire and rewiring the objects. Pop up on the wire where you wish to insert the object, and choose Insert>>; then go ahead and choose the object you want to insert from the Functions palette that appears. If the inserted function has two input terminals of the same type (e.g., the subtract function), you can choose which gets wired by popping up slightly above (for the subtrahend) or below (for the minuend) the original wire.

Moving an Object Precisely

You can move selected objects very small distances by pressing the arrow keys on the keyboard once for each pixel you want the objects to move. Hold down the arrow keys to repeat the action. To move the object in larger increments, hold down the <shift> key while pressing the arrow key.

Incrementing Digital Controls More Quickly

If you press the <shift> key while clicking on the increment or decrement button of a digital control, the display will increment or decrement very quickly. The size of the increment increases by successively higher orders of magnitude; for example, by ones, then by tens, then by hundreds, and so on. As the range limit approaches, the increment decreases by orders of magnitude, slowing down to normal as the value reaches the limit.

Entering Items in a Ring Control

To add items quickly to ring controls, press <shift-enter> or <shift-return> after typing the item name to accept the item and position the cursor to add the next item.

Cloning an Object

To clone objects, select the objects to be copied, hold down the <control> key (Windows), <meta> key (Linux), or the <option> key (Mac OS X), and drag the duplicates to the new position. The original objects remain where they are. You can clone objects into another VI window as well.

Moving an Object in Only One Direction

If you hold down the <shift> key while moving or cloning objects, LabVIEW restricts the direction of movement horizontally or vertically, depending on which direction you move the mouse first.

Matching the Color

To pick a color from an object, click on the object with the Color Copy tool. Then color other objects by clicking on them using the Color tool.

Replacing Objects

You can easily replace a front panel or block diagram object by popping up on it and selecting Replace>>. When replacing functions on the block diagram, a Functions palette will appear beneath the All Palettes>> submenu, where you can choose a new function. The new one will replace the old, and any wires that are still legal will remain intact. The Replace>> menu will also have a submenu allowing to access the palette where the object being replaced is located. For example, if you are replacing an array function, the Replace>>Array Palette submenu will be present. When replacing front panel objects, there are no submenus, just the entire Controls palette from which to make your choice.

Making Space

To add more working space to your panel or diagram window, hold down the <control> key in Windows, <option> key in Mac OS X, or <meta> key on Linux machines, and drag out a region with the Positioning tool. You will see a rectangle marked by a dotted line, which defines your new space. When you are happy with the size and location of the rectangle, release the mouse button to create the new space. If you wish to cancel the operation while it is in progress, press the <escape> key.

You can use this feature to easily create space between objects on your block diagram and front panel, but don't overuse ityou can quickly create a sloppy-looking block diagram (with lots of wire bends, which is considered bad "style") by adding space in this way.


Configuring Your Preferences

LabVIEW has many preferences and options you can configure to suit your taste and convenience by selecting Options . . . from the Tools menu. You can select which options category to view by selecting it from the Category list on the left side of the Options dialog window (see Figure 4.43).

Figure 4.43. Options dialog


Select Options . . . from the Tools menu and browse through the different options available to you. If you want to know more about options, look in the LabVIEW manuals or online help.




LabVIEW for Everyone. Graphical Programming Made Easy and Fun
LabVIEW for Everyone: Graphical Programming Made Easy and Fun (3rd Edition)
ISBN: 0131856723
EAN: 2147483647
Year: 2006
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net