‘User Interface’ Category Archives

There are multiple ways to replace things in your VIs. Knowing your different Replace options can help you choose the one that best fits your needs.

On the front panel, you can right-click on a control and choose one of the options from the Replace menu. This method will preserve some things about the original control. Unfortunately, it’s not obvious what things will be preserved. In most cases, LabVIEW will attempt to preserve the label, caption, value and dataflow direction (control/indicator). It may also try to preserve other things, such as the numeric representation, size or color. It’s hard to say what will be preserved without actually doing the replace.

Luckily, you have Undo if a right-click replace operation doesn’t do you what you want. But what do you try next?

Paste-Replace is a method of replacing a control without preserving any of its appearance attributes. It will, however, preserve things like connector pane placement, wire connection and associated block diagram elements (e.g. local variables and implicitly-linked Property/Method nodes). (By the way, right-click Replace preserves these things as well).

To use Paste-Replace:

Place the control you want.

Use Edit>>Cut (from the menu, or via keyboard shortcut) to put it on the clipboard.

Select the control you want to replace.

Use Edit>>Paste.

Note that Paste-Replace is not available when editing the LabVIEW block diagram. On diagrams, you almost always use right-click Replace. However, some structures (such as loops) have special Replace menu options to replace them with other structures without losing their contents.

I’ve invited him to Eyes on VIs to tell everyone about the latest companion product for LabVIEW, the NI LabVIEW Web UI Builder. If you have an application that uses web services and you want to make a web-based user interface for it, you might be interested in this Early Access release. Not only does it make web-based UIs… the editor itself runs entirely in the web browser!

Imagine you’re looking to quickly create a thin client user interface on Windows or Real-Time targets. Perhaps you are looking to deploy a remote system to monitor and control from anywhere, anytime using a web browser running Silverlight. There are plenty of options around, but none of them offer the ability to access web services while leveraging your existing knowledge of LabVIEW programming. Enter LabVIEW Web UI Builder.

Sample Applications Created by LabVIEW Web UI Builder

A Few Features that We Are Introducing

A while back, we asked ourselves how LabVIEW might behave as a web based UI builder. So we began designing and iterating. Countless iterations have given LabVIEW Web UI Buildera new and unique experience that is still complementary to LabVIEW. We have learned a lot from our iterations. In fact, we are still gathering data to help grow it into a final release. Here is a screenshot of the development environment along with a few features:

Development Environment

New Front Panel Control and Theme Designs

The Ribbon

The most obvious feature of WUIB is the ribbon. It’s located at the top of the application and houses the commands you use 80% of the time. We selected the ribbon for its extensibility and discoverability.

Contextual adorners

Context adorners appear when blocks or Front Panel controls are selected. This is where you will find your most frequently used commands. We hope this will complement the right mouse click menu when it becomes supported.

Zoom

Zooming makes it easy to navigate your diagram, perform wiring operations, or view your Front Panel and Block Diagram holistically. By default, you can use the slider at the bottom right or hold down the control key and scroll your mouse wheel to zoom.

The Palette

The palette is docked on the left by default, but you can place it anywhere you would like.

A Multiple Document Interface

Each document has its own tab in the IDE.

The Unused Items Tray

After dropping a Front Panel control or indicator, its corresponding block on the diagram becomes is easy to find in the Unused Items tray.

LabVIEW introduced the radio buttons control in version 7.1. [Before then you had to write diagram code to ensure that only one radio button in a group was TRUE at a time, which was very annoying. Individual radio buttons are still in the palettes and I sometimes see them being used inappropriately, e.g. in place of a checkbox].

Unfortunately, theÂ radio buttons control is somewhat confusing to new users. Here are the basics:

The group of radio buttons is a single control, with a single terminal on the diagram. Like a cluster, you don’t get terminals for the controls inside the group.

The radio buttons value is an enumeration of the contained button labels.

Similar to a cluster, you add radio buttons by placing them inside the bounds of the group. (You can also right-click on the group border and select Add Radio Button).

When laying out a panel, you sometimes want to “group” elements together. You can do this by leaving a little empty space around the group. In some cases, however, it’s better to use a decoration such as the Recessed Frame, especially if you want to label the group.

Unfortunately, if you need to show/hide (or move) the group programmatically, you’ll find that you can’t get VI server properties for a decoration like you can for a control.

I recently saw a discussion on info-labview about scaling objects when you resize the panel.

There are several options for how to do this, with different strengths and weaknesses.

Handle the panel resize event and programmatically resize and position everything. Flexible and powerful, but it’s a lot of work and the resulting code is brittle (which means it “breaks” easily – whenever you change your UI, you have to update your diagram).

Scale all objects on front panel as the window resizes (in VI Properties>>Window Size). Easy, but rarely does what you want. In most cases, you probably want some (but not all) of the controls to scale with the window. Also, this option has problems when the panel gets very small and then large again in that controls don’t return to their original size and position. If you use this setting, make sure you set a reasonable minimum panel size in VI Properties.

Scale Object with Pane (in control’s right-click menu). Easy, but limited to a single scaling object per panel unless you use splitter bars.

Splitter bars combined with object scaling options. This is a fairly easy, powerful technique. I’ll go over this one in more detail.

A friend asked me “what is the best control to use for a Boolean subVI input that has special true/false values, e.g. enabled/disabled?” She was dissatisfied with the “Enabled?” checkbox approach because it didn’t give an explicit name to the other state. Similarly, using the boolean text part with a switch only showed the name of the current state. She wanted a switch that showed the labels for both states.

I gave her this control and asked if it was what she was looking for. She said that it was!

She had known that you could put free labels next to the switch, but not that you could make them “owned” by the control.

You can add decorative elements (e.g. images, decorations, and text) to a control using the Control Editor (Edit>>Customize Control or right-click Advanced>>Customize). When you add them in the Control Editor, they become parts of the control. Then when you use the control on a front panel, it acts as a single item when moving, deleting, etc.

Now, another thing you should consider when making a subVI input with named states is whether it would be better to use an enumeration. This can make the diagram that calls the subVI easier to read. If you do want an enumeration, however, I highly recommend you make it a type definition as well. That way you can edit it later and automatically update all the places it’s used.

I recently talked to a student who would print out his LabVIEW graphs for his homework and then circle and label a point on them before handing them in.

While that approach certainly gets the job done, there is a simple way to label important graph points within LabVIEW: annotations.

You can right-click on a LabVIEW graph at edit time and select Data Operations>Create Annotation. (On a graph in a running VI, Create Annotation is in the top-level right-click menu).

You’ll get a dialog that lets you define the annotation name and some attributes. After you dismiss this dialog and create the annotation, you can right-click on it and change other attributes (e.g. color).Â (Important note: right-click on the annotation point, not the label).

Did you know that the LabVIEW Help is available on ni.com? You can read more about Graph Annotations there, and also rate the help topic and leave comments that help NI improve the documentation in future versions!

In the video, Simon makes a LabVIEW graph look more like one you might find in Microsoft Office.

Here are the steps demonstrated in the video, along with my additional comments:

Place a graph on a front panel. I usually customize controls from the Classic palette, but in this case the Modern one works as well.

Color any parts you want to “disappear” to Transparent color using the Set Color (paintbrush) tool.

Use the Properties dialog:

to show/hide parts of the graph;

to change the plot colors, line widths, point styles and fills;

to change the colors of the major and minor grid lines. To hide grid lines, color them transparent.

Color the background of the plot area using the Set Color (paintbrush) tool.

Set the plots to anti-aliased, if desired. This makes the plots smooth. Set this by right-clicking on the plot in the Plot Legend.

Some people are surprised by how much customization of plots is possible in LabVIEW. I have seen some really neat versions of various industry-specific graphs over the years. Do you have one to share? Send it to me and I’ll make a gallery!

Internally, LabVIEW uses a lot more system colors than the six that are available through the color picker.

Despite my post title, they’re not really “secret.” There’s an article on DevZone that shows them (circa LabVIEW 7.0) and provides VIs to give you their color values more easily. You can use them when you set colors programmatically. Once you have these colors in a VI you can use the “Get Color” (eyedropper) tool and “Set Color” (paintbrush) tool to apply them to other items interactively.

[Note: In later versions of LabVIEW,Â Most Recent Color has been deprecated and several colors have been added, which I’ll list below]. Read the rest of this entry »