Example Code

Controlling Tab panes with Boolean Buttons Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

 

Overview

This example demonstrates a method for:

  1. Using Boolean buttons to control a Tab Control
  2. Setting up interaction between the Tab Control and the buttons to highlight which page is currently active
  3. Programmatically accessing and altering clustered controls
  4. Altering the visual properties of Boolean controls based on their current state

 

Description

Sometimes, as part of a User Interface it may be useful to be able to control the active page on a Tab Control through a separate Boolean control.

This problem encompasses a number of smaller tasks which must first be overcome, such as how to programmatically link a set of buttons to a set of tabs and how to differentiate from buttons used for control of your tabs and buttons used for some other task.

This code takes a standard approach of using an event structure to manipulate the tab control's state using enumerations, however an extra step is incorporated to enable the controlling button to remain highlighted - this gives the user a visual cue that the current button pressed is related to the current tab selected. Additionally, if the user choses an alternative tab directly on the tab, it will highlight the corresponding button.

In order to give another level of visual cue, the Boolean controls have had their visual appearance modified to be more obvious when in their True state. This is done through the properties menu for the Boolean, under the Appearance tab and in the Colors option section for the On state.

 

Requirements

  • LabVIEW 2013 (or compatible)

 

Steps to Implement or Execute Code

  1. Download Project & Extract (Built for LV 2013)
  2. Open project and launch Button State Example.vi
  3. Run the VI
  4. Clicking on the Boolean controls to the left of the Front Panel will alternate what tab window is currently active
  5. Clicking on alternative tab windows will alter which Boolean control is currently active
  6. Clicking on stop will end the program's operation

 

Additional Information or References

VI Snippet of  Button State Example.vi

 121.png

 

**This document has been updated to meet the current required format for the NI Code Exchange. **

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.