From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

LED Xcontrol with 4 colors

Code and Documents

Attachment


Summary:

The LED is a common component (indicator or control) of every GUI. But, the current LabVIEW LEDs are a state representation of a ON/OFF button. Why…

If you want a RED, YELLOW, and GREEN LED to represent a traffic light or a RED, YELLOW, GREEN, and BLUE LED to represent state of a system, what are your options?

My LED Xcontrol is a simple decoration available on a multiple set of colors.

Function:

The LED Xcontrol consists of a standard decoration (round shape) and can be used as an indicator or a control. The BG and FG colors are configurable. Actually, 4 status are defined in a Typedef and the user can associate a color for each status.

Features

-               Simple Xcontrol integration into your project

-               Indicator or Control

-               Left-click menu for status selection (control mode)

-               Right-click menu for colors status edition

-               Property node to change colors programmatically

-               Enum typedef can be adapt to any situation (TD_status.ctl)

Steps to execute code:

  1. Download zipped folder and unzip to your machine
  2. Open the project file
  3. Run Gui_Led.vi
  4. Execute program
  5. Enjoy the LED Xcontrol as an indicator or a control

Screenshots:

Main Demo GUI (GUI_LED.vi)

10.bmp

6.bmp

Right-click menu, Status Color (edit mode)

7.bmp

Colors can be edit for every LED (2 LED with different colors per example!)

8.bmp

VI Snippet:

Snippet.png/servlet/JiveServlet/downloadImage/14824/adding+example.png

VI attached below

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

Comments
shred444
Member
Member
on

sweet, another xcontrol submission.  nice.

Contributors