LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I add entries to a radio button

I have a radio button with 10 entries.  I want one with 20 entries.  I also want to be able to assign the numeric value for each entry.  How do I do it?
0 Kudos
Message 1 of 13
(7,471 Views)
  1. Just add new boolean to the cluster.  You can place them from the Controls palette or copy/paste existing ones.
  2. Right-click on the control and select Reorder Controls in Cluster and click them in the order you want them numbered.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 2 of 13
(7,457 Views)

You can simply add new entries by selecting the last button, holding the control (ctrl) button on the keyboard and using the mouse to drag the radio button, thus duplicating it.  That is how I created the 20 radio buttons in the attached example.

 

What do you mean by assigning numeric values to each entry?

 

R

 

Message 3 of 13
(7,456 Views)
For Example: Let's suppose the radio buttons had values of 0,1,2,4,8... or 0, 2, 3, 6, 9, ...   How would I do it?
0 Kudos
Message 4 of 13
(7,449 Views)

How about if they had the values 0,1,2,3,4,5... because they do.  You'd need to either use these values or calculate a value based on them.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 13
(7,444 Views)

Are you referring to this radio button?

 

 

Because the output of the radio button control is a numeric which gives the value of which button is selected, starting at 0.

In the above image, the value would be 1 because it is the second one selected..  If it was the last one in the 20 radio button example of my first post, then the value would be 19. 

 

Unless you have the radio button by itself which is a boolean, but that gives you a 1 or 0. 

 

 

So I still don't understand what you are trying to do.  Can you explain why you want the value to be a specific number?  Are you referring to the label (instead of "Radio Selection 1" )?

 

R

Message Edited by Ray.R on 02-25-2009 02:56 PM
Download All
Message 6 of 13
(7,442 Views)

Hi ray,

 

I think he is trying to use the radio button to select one of 20 different values. An example would be if you want to return "0" for the first button, "1" for the second, 4, 8, 16 ,32... 

 

The radio button is a type of enum. Sparse Enums (enums with arbitrary values) can be used but not developed in LV.

 

A simple look-up table can be used to translate the enum to the numerics you desire.

 

Ben

Message Edited by Ben on 02-25-2009 01:55 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 13
(7,439 Views)

Hi Ben,

 

Ah... okay... in that case a lookup table or simply wire the value into the proper equation to translate it to the desired value, ie: 2 ^ val

 

R

Message 8 of 13
(7,433 Views)

Ray.R wrote:

Hi Ben,

 

Ah... okay... in that case a lookup table or simply wire the value into the proper equation to translate it to the desired value, ie: 2 ^ val

 

R


 

Sure that would handle my simple example.

 

That type of construct is handy if you are talking to a widget that has commands that are different numeric values. The radio buttons mutually exclusive behaviour force only one selection so when coupled with a look-up table the proper command code can be selected.

 

YOU take care of yourself,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 13
(7,429 Views)

Have a look at the attached example.  It shows a few approaches that you could use.

For a "look up table" I simply used an array.  Put your values into the appropriate element. The example does have an array of 20 elements.

 

RayR

 

PS: Ben, was your last statement for me? 

Message Edited by Ray.R on 02-25-2009 03:10 PM
Message 10 of 13
(7,426 Views)