Example Code

Custom Blinking Color and Size for Buttons and Other Controls

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

Download All

Overview

This example shows how to make a custom blinking control where you can set the blinking size and color. It uses two different methods described both in the Description section and on the front panel of the VI.

 

Description

There are two methods used in this VI of creating a custom blinking button. These are the "Double Button" method and the "Classic Button Blink" method.

 

The Double Button method uses two stacked buttons. The top button is a normal modern Boolean control. The background button is a classic Boolean indicator. You can select the blinking colors with the Colors[4] Input. If you select transparent as the Off Blink color, the button will blend into the background. A shift register is used to toggle the Background Button on and off to make it blink. You can use this method under ANY control.

 

The Classic Button Blink method uses a classic Boolean control which blinks the border color for both the true and false cases of the button. The code is more complex than the Double Button method but the front panel is also simpler.

 

In both methods, a while loop with a shift register is used to change the value of a boolean after each loop iteration. This allows the blinking effect to occur.

 

Use the Reorder button on the front panel to place or move buttons to the front and back. You can configure the Background Button with this example, then copy it to the front panel for another application.

2.PNG

 

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code Additional Information or References

  1. Download  and open the attached VI.
  2. Set desired color values.
  3. Run the VI.
  4. If the buttons do not blink, make sure the Turn on Blinking boolean is set to true. 

 

Additional Information or References

Front Panel

1.PNG

Block Diagram:

4.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.