Archive for the ‘helpful_tips’ Category

In most LabVIEW applications, the front panel of a subVI is displayed in order to retrieve inputs from the user, or to simply display information. By following these steps, brought to you by Darren Nattinger, you can make your subVI panels easy to develop and debug.

1. Handle the opening and closing of the subVI panel programmatically. Many LabVIEW users choose to use the SubVI Node Setup right-click option to display the subVI panel. But the downside to this option is that your subVI won’t run any initialization codes before displaying its panel. To bypass this problem use the FP.Open method to display the subVI panel once you have initialized it, and use the FP.Close method to close it once the user dismisses the subVI dialog.



2. Configure the VI Properties of the subVI properly. Set the Window Appearance in VI Properties to "Custom” and customize your settings to match the image below. As you can see there are various setting changes, in particular the “Show Abort Button” option is disabled to prevent users from closing your entire application by pressing Ctrl-. while your subVI dialog is active.




3. Call your modal dialog subVI dynamically. Whenever you run a VI, all of its subVIs are reserved for running, which means none of the subVIs are in edit mode. Any reserved subVI that has a modal window appearance will immediately be displayed if its front panel is already open. Since it is a modal window, you cannot dismiss it because it's reserved for running. The best way to avoid this problem is to call the modal dialog subVI dynamically by changing the subVI to “Load and retain on first call.”



>> Get more LabVIEW tips from Darren.

Happy Halloween, everyone! To celebrate, we're going to debunk some LabVIEW myths. Don't be tricked by these common misconceptions.




MYTH: The palettes are the best tool for dropping new objects in your VIs.


There are lots of treats hiding in the LabVIEW palettes, but it can be tough to actually find the things you want. If you want to leave work early to shop for that perfect Halloween costume, use Quick Drop to write your VIs and you'll be done in half the time it would have taken you with the palettes. Just press Ctrl-Space and type the name of the object you want to drop, and click in the VI to drop it. It'll be downright spooky how fast you write your VIs once you start using Quick Drop!


MYTH: Using subVIs always slows down your code.


LabVIEW is very efficient at calling subVIs, and proper use of subVIs can allow LabVIEW to manage memory more effectively. For those times where subVI overhead may be a concern, you can use the "Inline subVI into calling VIs" setting in VI Properties to completely eliminate any overhead associated with calling a VI as a subVI. You can be afraid of ghosts and ghouls, but don't be afraid of subVIs!


FACT: There is a picture of a duck hidden in the Duct image library in the LabVIEW Datalogging and Supervisory Control Module.


Enough said.


duck duct.png

LabVIEW users, there’s a keyboard shortcut that might help you with object movement.  By holding down Shift while dragging any object, you can resize objects proportionally in both directions. This resize shortcut allows users to keep the original height and width ratio of the object. If you want to keep an object centered and circular, hold down the Shift and Ctrl keys while dragging the object. And yes, this also includes objects on the block diagram.



>> Get more LabVIEW tips.

In LabVIEW R&D, there’s a lot that goes into creating LabVIEW features. The process includes specification documents, design reviews, code reviews, automated test plans, manual test plans, documentation, and more. When we’re done, we have a feature that is documented, tested, marketed, and officially supported.


But what about all those features that, for whatever reason, don’t get that level of attention? Maybe a feature is written just for an internal team at NI. Or maybe a developer didn’t have enough time to dot all the ‘i’s and cross all the ‘t’s on a really useful API. What happens to all of those features?


They get included in the vi.lib folder, of course! Most of the VIs you can drop from Quick Drop or the palettes live in your [LabVIEW 20xx]\vi.lib folder. But many other VIs that are not “official” LabVIEW features are available in this folder as well.


To learn more about some of these unofficial libraries that are already included with your installation of LabVIEW, join the Hidden Gems in vi.lib community group on This group includes a presentation given by Darren Nattinger, Principal Engineer in LabVIEW R&D, discussing many of the Hidden Gems VIs that he uses on a regular basis. Some of his favorite libraries include:


1. VariantDataType VIsvi.lib\Utility\VariantDataType
These VIs allow you to parse variant data to learn more about the specific data type contained within the variant. For example, here is a VI that uses the VariantDataType VIs to determine the strings used to define an enum:

And here is a VI that uses the VariantDataType VIs to determine whether or not a variant is an error cluster:


2. AdvancedString VIsvi.lib\AdvancedString
These VIs perform advanced string manipulation. One of the most useful VIs in this folder is Match 1D String, which searches the elements of a string array for one that matches a user-specified pattern. It’s basically like the
Search 1D Array function, but much more useful when dealing with string arrays:


3. Libraryn VIsvi.lib\Utility\libraryn.llb
These VIs perform myriad File I/O operations, including operations on LLBs and files inside of LLBs. Several of the VIs in this library are officially supported and included in Quick Drop and the palettes. But there are many other “unofficial” VIs in this library that are useful as well. For example, Create Directory will create a folder on disk, and any parent folders that don’t exist:

Another useful VI, Is Name, will test a string to see if it can be used as a file name on the specified file system:


4. _analyzerutils.llb VIsvi.lib\addons\analyzer\_analyzerutils.llb
These VIs are a random assortment of useful VI Server and VI Scripting VIs. They are used extensively by the VI Analyzer Toolkit, but they are also generally useful for other scripting applications. Check out
this page on the VI Analyzer Enthusiasts group on for a detailed description of many of the VIs in this library.

5. lvconfig.llb VIsresource\dialog\lvconfig.llb
Ok, this last one doesn’t live in vi.lib, but it’s still really useful! Located in your [LabVIEW 20xx]\resource\dialog folder, the VIs in lvconfig.llb allow you to read and write tokens in your LabVIEW INI file, regardless of what platform you’re using, and where the file is located. One potential use case for these VIs involves programmatically updating your LabVIEW preferences settings (i.e. the settings in Tools > Options), perhaps as part of an automated install of LabVIEW.


These are just a few of the many hidden gems readily available in your LabVIEW folder. So check out the Hidden Gems in vi.lib community group to learn more about all these great libraries and utilities that you already have access to in your LabVIEW installation. You don’t want to end up writing a really useful VI only to find out it was already in VI.lib!

Wouldn’t it be nice to use standard keyboard shortcuts, such as Ctrl+B for bold, for text editing in LabVIEW? If you have LabVIEW 2013, you can. Just add the following token to your INI file: QuickBold=True


Now, whenever you’re editing text on the front panel or block diagram of a VI, Ctrl+B will bold/unbold text.


Keep in mind that this QuickBold option is only activated while editing a text field, so you can still use Ctrl+B  for removing broken wires.


Special thanks to Certified LabVIEW Architect Darren Nattinger for sharing this awesome tip.


>> Submit other ideas for features at the LabVIEW Idea Exchange.

This guest post was written by LabVIEW Champion Steve Watts.


For a splash screen to become GROOVY it needs to have a strange shape, exhibit the right kind of transparency, fade in, and have some nice custom progress stuff going on.


Interested? Here's how to do it. Code is posted here-- download


The LabVIEW bit

You will need to dynamically load the splash screen and then some time after the main program. For a nice fast startup, we want to load the main program in the background and then show the front panel.


Startup VI


DynLoadSplashscreen.pngFirst, dynamically load and run the splash screen.
DynLoadMainscreen.pngThen, start loading the main program.
BringUpMainscreen.pngAfter a bit of a wait, bring up the main screen.
CleanUpSplashscreen.pngLast, tidy up the splash screen.


Splash Screen

This is the pretty bit. First, let's get the graphics. Cut and paste the image into and use the magic wand tool.


This selects a block of color that you can delete (make transparent). Delete anything else that you are going to replace. In this case, I deleted the progress, version, and link to the website.


Next we load this into our Splash Screen VI by Edit >> Import Picture to Clipboard... like this.

Splashscreen vi.png


The progress indicator is simply a ring control made from a rotated metafile created in LibreOffice.




Green Screen Transparency


Now the clever bit is that we do not use the property FP.Transparency for this, as it's mostly for fading in and out. We're after a green-screen effect where the background colour is masked. For this we need to use some Windows functions.


User32.dll>>FindWindowA - Gets the window handle.

User32.dll>>GetWindowLongA - Retrieves information about the specified window. The function also retrieves the 32-bit (DWORD) value at the specified offset into the extra window memory. We're after extended windows styles.

User32.dll>>SetWindowLongA - Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory. The window is a layered window.

User32.dll>>SetLayeredWindowAttributes - Sets the opacity and transparency color key of a layered window.




So now you have no excuse for dull, rectangular LabVIEW!