Designing User Interfaces

If a VI serves as a user interface or dialog box, front panel appearance and layout are important. Design front panels to resemble instruments or other devices so users easily can identify which actions to perform. Use front panel controls and indicators, splitter bars and panes, window settings, and so on to improve the usability of the front panel. You also can use events to enhance the functionality of user interfaces.

Designing Front Panels

The main components of the front panel are controls and indicators. Use the following guidelines to design the front panel to serve as a user interface:

Configuring Fonts and Colors

You also can improve the usability of user interfaces by configuring fonts and colors. LabVIEW defines its built-in fonts as the default system fonts. When you move VIs between platforms, LabVIEW automatically updates its built-in fonts so that they match the default system fonts of the current platform. Additionally, if you attempt to open a VI that uses an unavailable font, LabVIEW substitutes the closest match. LabVIEW also substitutes colors similarly to how it substitutes fonts. If one of the colors of the VI is unavailable, LabVIEW replaces it with the closest match. The system colors vary across computers, so any VI that uses system colors reflects the specific system colors of the current computer. The system colors also define the appearance of Panel & Object, Window, and Highlight, and the color of the text that appears on top of these system colors. You can configure user-defined colors and view system colors in the Options dialog box.

Refer to the following example at ni.com for more information about system colors.

Using Splitter Bars and Panes

You can use splitter bars, such as toolbars or status bars, to create professional user interfaces in the front panel window. You can create a splitter bar to separate the front panel into multiple regions, called panes. Each pane acts similarly to a unique front panel, with its own sets of pane coordinates and controls and indicators on it. You can scroll each pane individually. The splitter bar separates the controls on one pane from those on another pane, yet the terminals for all controls are on the same block diagram.

When you create a new, blank VI, the front panel has a single pane that fills the window. The front panel owns this pane and is the pane's parent. When you place a splitter bar on a pane, the splitter bar replaces the pane in the front panel object hierarchy and creates two new child panes. The front panel owns the splitter bar, and the splitter bar owns the two child panes. If you place a new splitter bar on one of the child panes, the new splitter bar replaces that pane and becomes the parent of the two new child panes. This hierarchy forms a binary tree, and the front panel owns the top pane.

Refer to the Resizable Panel with Splitter Bars VI in the labview\examples\Controls and Indicators\Containers for an example of using splitter bars and panes.

Open example� Find related examples

Configuring Splitter Bars

Right-click a splitter bar and select one of the following shortcut menu options to configure splitter bars:

You also can use the Splitter properties to configure splitter bars programmatically.

Configuring Panes

Right-click a scroll bar in the pane, or right-click a splitter bar and select the pane you want to configure and select one of the following shortcut menu options to configure panes:

Note��If you turn off the horizontal or vertical scroll bar by right-clicking the scroll bar in the front panel window, you can display the scroll bar again by enabling the Show horizontal scroll bar option or the Show vertical scroll bar option in the Customize Window Appearance dialog box.

If there are no splitter bars on the front panel, you can configure some properties of the single pane in the VI Properties dialog box. However, if you add a splitter bar to the front panel, LabVIEW limits the menu options in the VI Properties dialog box because the configurations cannot apply to all panes. You must configure each pane individually. For example, adding a splitter bar to the front panel dims the Scale all objects on front panel as the window resizes checkbox on the Window Size page of the VI Properties dialog box.

You also can use the Pane properties to configure panes programmatically.

Designing Dialog Boxes

Select File�VI Properties, select Window Appearance from the Category pull-down menu, and select the Dialog option to hide the menu bar and scroll bars and to create VIs that look and behave like standard dialog boxes for each platform.

If a VI contains consecutive dialog boxes that appear in the same screen location, organize them so that the buttons in the first dialog box do not directly line up with the buttons in the next dialog box. Users might double-click a button in the first dialog box and unknowingly click a button in the subsequent dialog box.

Users also might attempt to use the keyboard shortcut <Ctrl-Z> to perform an undo operation while a VI is running. This can cause unexpected behavior in dialog boxes, such as a closed dialog box reopening. To avoid this behavior, you can create a custom menu that does not include the Edit�Undo option, or you can add an Event structure to the VI and configure the Menu Selection (App) event to handle the command.

Use the system controls located on the System palette in dialog boxes you create.

Selecting the Screen Size

When you design a VI, consider whether the front panel can display on computers with different screen resolutions.

Consider making the window as small as possible without crowding controls or sacrificing a clear layout. Some displays have a limited resolution, especially LCD displays and touchscreens.

Also, configure front panels to open in the upper-left corner of the screen for the convenience of users with small screens. Place sets of VIs that are often opened together so the user can see at least a small part of each. Place front panels that open automatically in the center of the screen. Centering the front panels makes the VI easier to read for users on monitors of various sizes.

In VI Properties, select Window Size in the Category pull-down menu, and place a checkmark in the Maintain proportions of window for different monitor resolutions checkbox to maintain front panel window proportions relative to the screen resolution.