LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a 3-state button (similar look as OK button) that toggles between 3 different colors.

How do I create a 3-state button that looks similar to the OK button except it changes to 3 different colors every time it is pressed. Does anyone have such a control ready for use that I can just drop in my front panel?
0 Kudos
Message 1 of 12
(3,275 Views)

So what you want is to have the button that starts out as one color. You press it and it turns a second color. Press it again it turns a third color, right? If that's all you need create an event-driven interface that has a Value Change event for the button. Each time the event fires, use a property node to change the color of the button.

Do you need to see an example?

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 12
(3,267 Views)
Try something like this.

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 12
(3,269 Views)
Mike. Thanx so much. That's exactly what I needed.
0 Kudos
Message 4 of 12
(3,247 Views)
I need to use this VI many mnay times. How do I make a sub VI out of this and call it. Can you give me an example?
0 Kudos
Message 5 of 12
(3,227 Views)
With a picture ring you can implement a 3 color button without any code. Look at the attached customized control.
I have imported the picture of a boolean in three different items and colored them. I centered the text and hide/made transparent uneeded graphic elements. I set the size of the decrement arrow to cover all the picture and made it transparent so when you click on the control you decrement the value of the ring and change the picture/color

Edit: you'll notice that the picture is not fullt covered by the decrement arrow so if you click near the bottom of the button, the picture ring will show its normal behavior displaying all 3 available items

Message Edité par Jean-Pierre Drolet le 07-07-2005 10:07 PM



LabVIEW, C'est LabVIEW

Message 6 of 12
(3,224 Views)

There are always multiple ways of doing things in LV and if you want multiple controls with this behavior, Jean-Pierre's solution is probibly better. The important thing to remember when choosing between competing implementations of the same function is to consider the strengths and weaknesses of each.

For example, if you need to simply toggling between some N-number of set colors, Jean-Pierre's control is clearly the way to go. Neat, reusable and no code required. (BTW, He's a great guy to have giving you advice.) On the other hand, if the colors might need to change, or different controls might have different colors, or you only want to change the color state of the control if some operation completes successfully, then you might want to consider my approach. It all depends on how you want the interface to work.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 12
(3,196 Views)
Mike and Jean-Pierre, thank you for the great ideas. Mike you're right. There are many ways to do the same thing in LV. As I mentioned, I need to use this control many many times in  my app. And the colors are always the same. So, I'll use Jean-Pierre's picture ring control. Jean-Pierre, would you please send me the control file that you created. I'm new to LV development and would like to learn how this sort of thing is done. Thanx a lot to both of you.
0 Kudos
Message 8 of 12
(3,177 Views)
You don't need a control file, just customize the control from the VI front panel in the control editor, edit it to your needs and save it. Use menu Edit>Customize Control...


LabVIEW, C'est LabVIEW

0 Kudos
Message 9 of 12
(3,171 Views)

Jean-Pierre,

How did you make the down arrow transparent?

0 Kudos
Message 10 of 12
(3,154 Views)