Example Code

Tristate Button Control

Code and Documents

Attachment

Here is a simple example of a customized picture ring that is made to work like a tristate button control. The increment button of the ring is made to extend over the entire area of the picture & the button is made transparent. Now any clicking will be on the increment button.

This can be extended to any number of states.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
JockeR
Member
Member
on

This is exactly what I was looking for. But how do you change the colors?

Priyadarsini
Member
Member
on

Hi JockeR,

The control is a picture ring - each item is a picture filled with the needed color - here there are 3 pictures with colors red, green and black. Clicking on the control is like clicking on its increment button (you can use the Advanced>>Customize window to see the overlay) and the pictures are traversed in order.

testdesign
Member
Member
on

This is really good information Priyadarsini.  The thing I can't get is when I put down an Enum Picture Ring on the front panel I am unable to customize it.  Which enum pict control are you using?  Silver, Classic, or Modern enum pict control?

Also, when clicking on the picture how do you customize the enum picture control to work as if you were clicking on the increment button?

Thanks so much!

TeraTech
Member
Member
on

Nice but lacks clarity when using it as to the purpose of each color.  I guess you could add some labels? But don't like that the user has to click through one state to get to another state. Could be bad depending on the code behind it. Also, I couldn't figure out how to edit the colors from the customize menu. I like this one

https://forums.ni.com/t5/LabVIEW/Front-panel-control-with-3-states/m-p/3580050/highlight/true#M10023... 

^TeraTech.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Check out this lengthy post of mostly complaints)
Contributors