Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
13 ratings:
 4 out of 5   

How Can I Change the Blinking Color of a Control Programmatically?



Primary Software:
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I want to change the blinking color of a string control or indicator while my VI runs depending on the state of my program.  I cannot find a property that allows me to do this.  How can I accomplish this?

Solution:
Although there is not a property that allows the user to change the blinking color, it can be done programmatically by periodically changing the background color of the control or indicator.
  1. Place a string control/indicator on the front panel.
  2. On the block diagram, right-click the control and select Create»Property Node»Text»TextColors»BG Color.
  3. Right-click on the property node and select Change All To Write.
  4. On the front panel, place a color control from the functions palette: Modern»Numeric»Framed Color Box.
  5. On the block diagram, wire the color control to the Text.BGColor input of the property node.
This allows the background color of the string control to be changed programmatically.  In order to make the background blink:
  1. Create a state machine with two cases (i.e. BGColor and BlinkColor).
  2. Each case should change the Text.BGColor and then proceed to the next state (See figures and attached example below).


Figure 1: BGColor case for example blinking algorithm.



Figure 2: BlinkColor case for example blinking algorithm.

Note: This is one algorithm that will allow the user to control the blinking color programmatically. There may be other ways to accomplish this task. If you do not need to change the blinking color while the program is running, you may change the settings by going to Tools»Options. Select the Environment category, and then scroll down to the Colors section.  This allows you to change the global LabVIEW color properties.


Related Links:
Developer Zone Tutorial: Application Design Patterns: State Machines
KnowledgeBase 3E586ILE: Best Way for State Machine to Handle Three or More Transitions
KnowledgeBase 2F6CB7DV: How Can I Get My Blinking Colors to Be the Same in an Executable as in the Development Environment

Attachments:


BlinkingColor.vi


Report Date: 04/15/2008
Last Updated: 11/04/2013
Document ID: 4KEHH31D

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