LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to change color of slider on different values?

I'm trying to set up an instrument that receives data from a sensor. My idea is to show a sliders with the values read and accordingly  represent acceptable levels in one color and whatever is above it on a different color (lets say green and red).
Any ideas would be appreciated.
0 Kudos
Message 1 of 5
(7,402 Views)

You can use a property node to access the fill color property of the slider. Then just set your limits to select the different colors.

 

Message Edited by AndrewAlford on 11-24-2005 09:02 AM

Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
Message 2 of 5
(7,390 Views)
You're going to have to use a Property Node for the slider to change it's color.

The attached VI shows a simple example of how to do this.

  1. Right click on the indicator and select 'Create>Property Node'.
  2. Right click on the property node and select, 'Change to Write'.
  3. Right click on the node again and select 'Properties>Fill Color' (or other property you want to change).
  4. Create the logic to watch for the value over limit.
You do have to be careful using property nodes. They are very useful, but they also have a performance hit on your application. You should construct a way to only write to the node when you need to change something. Constantly writting the same value to the node (as my quick example is doing Smiley Wink) is not good programming practice.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 3 of 5
(7,387 Views)

Thank you very much for the responses, as might have guessed, I'm just starting in the "ways" of labview.

Just out of curiosity, as far as I can see it is not possible to set colors in gradients. Am I right?

Thanks again.

Eduardo

0 Kudos
Message 4 of 5
(7,369 Views)
Colours in LabVIEW are represented by a 3-byte number FF FF FF, with each byte representing Red, Green and Blue respectively.  So you *could* multiply your input by 255/max input and then use that as one of the bytes (or subtract that from 255 for the inverse).  I did this with a progress bar that started at green (00 FF 00) and ended on red (FF 00 00).

I've included a sample here. I did this LV 6.1 so more people could see it (if they care).

     Rob
Message 5 of 5
(7,350 Views)