Tips and tricks

From LabVIEW Wiki

Jump to: navigation, search
Tip.png

This article lists tips or tricks that become common wisdom once you've been using LabVIEW forever, but which newbies are sometimes uninformed of. Sometimes you discover something "new" that has never been mentioned anywhere and have never stumbled upon before. You wind up asking yourself, "How come I never knew this?"

Let's share our favorite insights here and we can use this article as starting point for introducing new users to some cool tips and tricks right away. This article should help the newcomer quickly become a masterful LabVIEW programmer!

Note: Only a few keyboard shortcuts are listed here in the tips and tricks. For a complete list go over to the LabVIEW keyboard shortcuts.

Contents

Uncategorized tips

Editor Note: Place new tips and tricks here if you can't decide or care about categorizing them. Someone else will find a place. If your tip deserves a dedicated section, go ahead.

String constant wrapping right while typing

When you drop a string constant, if you type text, all the text appears on a single line. If you type long enough, you start stretching out your autogrowing structure nodes and overlapping other parts of your diagram. You can type a carriage return, but that puts an extra character in your string. What most people do is stop typing, resize the string to the size they want and then go back to typing in the value. The trick is shift+Return. When you're typing in a string constant, the first shift+return will stop the string growing horizontally. As you type after that, the string will word wrap and add lines to the constant. Then if you do shift+return again, you'll turn on the vertical scroll bar. Now the string constant won't grow any further at all.

String control or constant

Drag and drop VI icon over string control to get the VI name into the control.

Tools Palette

LabVIEW tools palette

Multiple formats and text in a numeric indicator

It is a little known fact that you can have static text embedded in the contents of a numeric control or indicator. You can also specify more than one format string which results in multiple versions of the same number in the indicator. All of this magic is done using the advanced editing mode in the display format dialog of a numeric control or indicator. One great use-case for this is to display units to the right or left of the numeric (ex: 1.35 Volts).

Displaying some static text along with the number
Displaying both a decimal and binary of a numeric value

To display percentage without explicit scaling, for example set the format to "%d %%" and the unit string to "cm/m". The controls stays unit-less but the displayed number is multiplied by 100 (100cm in 1 meter).

Icon editor

VI icon editor
  1. Open the icon editor
  2. Ctrl-Shift-Click anywhere on the background colour
  3. Using the selction tool, select the text to be deleted and hit Delete (note that the background gets filled with the proper colour, not white)
  4. Select the text tool and type in your new text

Wiring

Case structure

Please take a look at the Case Structure page.

Error handling

Navigation

Project environment

Switching application instances

Call library function

Specify a path to the library with a constant

Use the "Specify path on diagram" to determine if you can input the Library name or path on the block diagram. When you place a checkmark in this checkbox, path in and path out appear as input and output terminals on the connector pane for the node. When you place a checkmark in the checkbox, any library referenced in the Library name or path control will not be used.

Note: You can use the path in input to unload a previously referenced library from memory. Wire an empty or invalid path to the path in input to unload any library previously referenced by the node from memory.

Formula node

LabVIEW Classes

You can create a directory on disk named the same as the LabVIEW class to save the class library file, class member VIs, and class custom default probes. You can include the files that the class library owns in the directory. If you include files for more than one class library in the same directory, conflicts might occur if you try to include VIs of the same name in different class libraries. Naming conflicts can occur in the development process when you override dynamic member VIs.

Template VIs

You can add templates as subVIs to a template VI. To add a template as a subVI, open the VI template and drag the VI icon in the upper right corner of the front panel or block diagram window to the block diagram of the top-level template VI. When you create a VI from a template that contains template subVIs and save the VI, LabVIEW prompts you to save each template subVI as a VI.

Navigating controls and constants

Graphs

Debugging

Editing

Simply creating a control reference

Performance

Calling or creating a subVI

Calling a VI in the same directory
Calling a VI dynamically using the Call Setup menu option

File path control or constant

Resizing Objects

Moving objects

Simply hold down the <SHIFT> key before clicking on an object or a selection and move with confidence ! Your movements will be constrained to Left/Right or Up/Down.
Before moving a selection
After moving a selection - shift unused
After moving a selection while holding down shift

Match Regular Expression

Documentation

Dialog label example

Hardware IO

Palettes

LabVIEW function palette

Menus

XControls

There is a way to create so called "pull-right" properties for XControls. Change the localized long name of the property to include the nesting. For Example: If you have a property called My New Nested Property 1 and you want the menu to appear like Mike->My New Nested Property 1, set the Localized Long Name to Mike:My New Nested Property 1. Colon is used as the separator.

Configuring an XControl sub-property menu
What an XControl sub-property menu looks like

Closing References

Closing an array of references

VI Usage

Closing a VI without a save prompt

See also

Personal tools
Namespaces
Variants
Actions
Navigation
interaction
Toolbox