Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
9 rating:
 1.88 out of 5   

Changing True/False Boolean LED Colors in LabVIEW



Primary Software:
Primary Software Version: 8.2.1
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Professional Development System, LabVIEW Development Systems>>LabVIEW Base Package

Problem:
I have a Push Button that is set to Switch When Released. It has four states: False, False-to-True, True, and True-to-False. I know I can change the Push Button LED color for True and False state by manually customizing it. I would also like to be able to change color for True->False and False->True states. How can I accomplish this?

Solution:
By default, the False and True-to-False color is set to dark green and the True and False-to-True color is set to bright green.

The Colors[4] property (accessible via property node) will allow you to change the four colors of the button itself, but it does not change the color of the LED. You can manually change only the True and False LED color.

To be able to control True-to-False and False-to-True colors and avoid seeing a change in color for these states, you need to use two push buttons, one on top of the other, and change their visibility based on the mouse events.
  1. Place a Push Button button2 on top of another button1.
  2. Right click button2 and select Properties. Switch the On and Off colors found in the Appearance tab and press OK.
  3. Right click button2 and select Advanced»Hide Control.
  4. Use an Event Structure to detect a Mouse Down event for button1 and a Mouse Up event for button2.
  5. For the Mouse Down event, hide button1 and make button2 visible by using the Visible property.
  6. For the Mouse Up event, make button1 visible again and hide button2.
  7. Since only the Mouse Up action will be performed on button2 when it is visible, you will have to change its value to the current value of button1 during this event. To do this, change button2 to an indicator, and use a Value property node to wire the value of button1 to button2
See the attached VI for reference.

Related Links:
KnowledgeBase 3C0HLMPC: How Do I Change the Color of a Boolean Control or Indicator Programmatically?

Attachments:
True_False_Bool_control.vi





Report Date: 01/31/2003
Last Updated: 12/17/2013
Document ID: 2TUDF5DW

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit