LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically create indicators

Hi - I was trying to figure it out the vi posted by Randall also (thanks Randall!)
 
Here's my take on it:
The 255 and 511 are there to facilitate value ranges from 0-255 for color, let me see if I get this right...
 
1) Randall is using slider controls going from 0-100 to control a gradient color on booleans
2) When thinking of colors think of going from 0-255 on Red and Black and Blue to get whatever color you want.
3) Let me jump ahead for a brief moment to discuss what the Boolean requires for a color change.  It can accept an array of up to 4 pairs, with each pair being a cluster of two unsigned 32 integers (one pair if for background color, one if for foreground)
4) To create those U32's lets go back to what happens when the slider is from 0-50 or between 50 -100.
5) When its less than 50 (false case), create a U8 for that value (the value will be based on a percentage of the slider ( (0-50)/50  *  255) so that U8 will represent a value between 0 (0000 0000) and 255 (1111 1111)
6) But we ultimately want U32's for the boolean Color[4] property so lets build it
7) Join numbers to create a U16, then a U32
😎 In the case where its less than 50, Randall creates a U16 (the upper Join in the diagram) that stays at zero and a U16 that uses the U8 value as its most significant byte.
9) Then build a U32 from those and wire them together as foreground and background for this control will be the same
10) Now what about when its over 50?
11) The upper U8 in the diagram goes from 0-255 (511 * a value from 0-1, thus a value from 1-511, but  the U8 gets only the lower 8 bits, thus 0-255)
as the slider goes from 50-100
12) The lower U8 in the diagram goes from 255-0 (511 - a value from 1-511, but the U8 gets only the lower bits, thus 255-0) as the slider goes from 50-100
13) Then build up the U16 to the U32 then into the color[4] property of the booleans.
 
Now perhaps one could use a slider that went from 0-255 and played with a different scheme, but his vi seemed to work well so I wanted to figure it out and write it down (which helps me understand as well) - Thanks again Randall.
 
Sorry for being so wordy.
 
- Con out
 
Kinda wordy, but I was trying to explain it to myself too.
0 Kudos
Message 11 of 21
(2,470 Views)
Is it absolutely necessary for there to be an indicator for every element in the array?

I would probably have a number control that could select the index in the array... then have a single indicator which would indicate wether the value at that index has passed or failed.

This way you could just individually selected which values you wanted to check.


This may not be the functionality you seek, but whenever I ask a question, I always like to hear other ideas. Smiley Very Happy
0 Kudos
Message 12 of 21
(2,454 Views)
I absolutely need to have multiple indicators. I am writing an application that monitors any intrusion in a perimeter. I am trying to show the locations on the map using the booleans.  Since the sensors are dispersed throughout the perimeter, i will need multiple indicators to show the actual locations of the sensors on the field. 
 
I was curious to know if anyone has done an application similar to mine and if so, what were the main challenges?  Another question..when one (of more) of the LEDs show a threat/intrusion (red color), i'd like to be able to click on that LED and display the actual sensor readings.  Is it possible to change the state of the indicator to a control on the fly?

Thanks
KM
0 Kudos
Message 13 of 21
(2,452 Views)

A couple of options:

One is to use a picture control to show the map, then use the drawing tools to add to the drawing and put circles for example wherever the sensors are located.  You can use x,y coordinates to place lines, circles, etc onto a picture control. 

A second option is If your sensors never move you could simply place whatever boolean lights you want on top of the picture for example.

As far as the ability of clicking on a sensor to display other stuff... one option may be to again use the picture control and then experiment with mouse click functions to determine where you are on the map and bring up the appropriate sensor maybe?

Im not sure about switching between controls and indicators on the fly.

Goodluck

0 Kudos
Message 14 of 21
(2,441 Views)
If you are using LV 8... read this:
http://community.ni.com/examples/linked-object-list-in-labview-8-0-using-xcontrols


You have to open the project, then the example file from within the project. This code is as close to "dynamic" creation of front panel indicators as I have seen.

Good luck.
Message 15 of 21
(2,437 Views)
KM - what about this as a quick option:
 
Drop boolean indicators on the map at their locations, use the "Tip Strip" property of the indicator (which has a string input) to show the information you want about that sensor - you would of course have to build the string to include the information you want.  The user could then hover the mouse over each boolean indicator and get a quick Tip Strip type window to show your info.
 
?
 
Just an idea

Message Edited by wrath_of_con on 09-02-2006 01:38 PM

0 Kudos
Message 16 of 21
(2,416 Views)

I have done the complete dynamic creation thing complete with left and right mouse clicks and mouse over.

It was all based in the LV picture control.

UncleBump gave a post to the thread where I originally posed the idea of drawing the control and JPD taught us all how to use the invoke image method to make the drawing easy.

A collection of picture control examples can be found in this thread.

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=14&jump=true

I'd also like to direct your attention to reply #52 of this thread

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=5&jump=true

where I used booleans to illustrate an "randow walk" version of the game "Hang Man" to spell out the classic phase "hello world".

Now if I could re-write this example to use the new 3D picture functionality...

Have fun,

Ben

PS If you customize your controls and indicators by importing your own images, ...

Message Edited by Ben on 09-02-2006 03:55 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 17 of 21
(2,401 Views)
Thank you everybody for providing several options.  I will play with the options and see how they come out. 
KM
0 Kudos
Message 18 of 21
(2,338 Views)

Hi KM,

If you develop something that you think could help others, please post an example!

Thank you ,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 19 of 21
(2,334 Views)

sure... will definitely do so.. thanks

km

Message 20 of 21
(2,327 Views)