LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I build an on-off-on boolean control?

I need a horizontal boolean switch that has on (left) - off (center) - on2 (right) positions. Any ideas?
0 Kudos
Message 1 of 15
(4,673 Views)
What you would do is modify a slide control. There is an example at http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&BF06AE16FD85ECD58625683A000A66E4&cat=01DA3ED38B8928E1862567AC0057F0AD that shows a 3 position vertical switch. You can get even fancier. I use a modified vertical slide as a radio button control. I've attached this control.
Message 2 of 15
(4,673 Views)
Thanks for the quick help! Sounds like a good Idea, I'll give it a try.
0 Kudos
Message 3 of 15
(4,673 Views)

Good afternoon.

The hyperlink doesn't work , could you please explain me how did you do, i hav the ame problem and i do not know how change default controls.

Best regards,

Thank you

0 Kudos
Message 4 of 15
(4,271 Views)

The link worked fine for me, so you might want to try again.  I am surprised it worked since the thread is 9 years old.

0 Kudos
Message 5 of 15
(4,257 Views)

Hi,

YEs, i did not see, 9 years old !

Could you please tell me what do you use "vertical switch" or other.. and how do you change the OnOff action  to OnOffOn .. ? I've tried, but without result.

 

0 Kudos
Message 6 of 15
(4,247 Views)

You cannot use a boolean switch.  Booleans have only two states, on-off.  You are asking for three states, on-off-on.  You can use a vertical pointer slide control (look in numerical palette).  Right click and bring up the properties page.  Go to the Data Entry tab.  Uncheck Use Default Limits.  Set minimum to 0 and maximum to 2.  Click OK.  On the control, double click on the top number of the scale, change it to 2.  Now you can move the slider to 3 positions, 0-1-2.  These 3 values can be used to represent on-off-on.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 15
(4,236 Views)

 

 


@tbob wrote:

You cannot use a boolean switch.  Booleans have only two states, on-off.  You are asking for three states, on-off-on. 


 

Well, two of the states have the same value, so a boolean datatype would still work (unless the code needs to know which one of the two ON is currently in use ;)).

 

I would probably make an Xcontrol with a boolean datatype and some logic (for some ideas, have a look here).

 

 

0 Kudos
Message 8 of 15
(4,225 Views)

@altenbach wrote:

 

 

Well, two of the states have the same value, so a boolean datatype would still work (unless the code needs to know which one of the two ON is currently in use ;)).


Typically an on-off-on switch has 3 values.  The text happens to be the same for the on's, but they have different meanings.  Maybe it should be labled on1-off-on2.  It would serve no purpose to use an on-off-on switch if the two on's served the same purpose.  Consider a situation where one motor opens a valve and another motor closes the valve.  One switch could supply voltage to both motors, but only one at a time.  Then the labels would be close-off-open.  However, in switch terminology, they are typically called on-off-on.

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 15
(4,214 Views)

The original thread is about 9 years old, so Dennis's answer is a bit stale. The version posted is also too old to open in modern LabVIEW versions.

 

If you really want three distinct states, use a radiobutton control with three custom buttons. (Dennis's file name gives a hint, but I don't think the stock radiobuttons were available back in 2001). 😄

 

The radiobutton control is like a specialize container, exclusively for booleans. Remove the existing controls, and place your own buttons. Arrange vertically or horizontally. The datatype is an enum with the states named after the boolean labels.

 

(Note that there is the annoying restriction that a radiobutton control cannot be empty, meaning you have to add the custom buttons first, before removing the last existing one. I guess nobody else is bothered by this, because my idea does not seem to be very popular. 😞 Otherwise, please vote for it! :D) 

0 Kudos
Message 10 of 15
(4,207 Views)