LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get selected Enum from a radio button

 

Hi all

I have a property node of a radio button (3 buttons "good, "bad", "ok". I input the reference. I have the "value" as an output. This comes as a variant. In the probe window I can see what button is selected. How can I get this data out of the value-variant? Either as an enum text or as a number of the pressed button. A text like "good", "bad" or "ok".

 

Thanks for any help.

0 Kudos
Message 1 of 14
(2,589 Views)

Show some code. If you have a reference to that specific radio button, the Value property node should be the actual value not a variant:

 

Spoiler
FireFistRedhawk_0-1636466419557.png

 

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 2 of 14
(2,561 Views)

if I have an Event for one radio button I got a value I can use, with several events the value changes to variant and I have to somehow sort out the pressed button

0 Kudos
Message 3 of 14
(2,549 Views)

@Robi_F wrote:

if I have an Event for one radio button I got a value I can use, with several events the value changes to variant and I have to somehow sort out the pressed button


That's not code, that's a picture of the code, and a small, tiny picture of an event structure that we can't even look at.  My guess is it's not a radio button at all, but three Boolean controls, probably set to "latch when released", maybe in a cluster, maybe not.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 14
(2,547 Views)

I echo what bill said. We want to help you but we don't want to have to guess, so if you are allowed to, please upload the actual code when you make posts.

 

My guess (groan) is that you have a single event case that handles multiple radio buttons of different structures. The (far) easiest solution would be to make a separate event case for each one of your Radio Buttons. Then in each event case, the CtlRef that you are using will be the specific to that Radio Button and will therefore give the proper data type.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 5 of 14
(2,540 Views)

Sorry folks I didn't want to waste your time. I just realised that when the property node is radioBtnsControl the value output is a variant. When it's radioBtnsControl(strict) it is changing to enum (that's what I want). So I only need to know how I can change a radioBtnsControl into a radioBtnsControl(strict). 

0 Kudos
Message 6 of 14
(2,535 Views)

@Robi_F wrote:

Sorry folks I didn't want to waste your time. I just realised that when the property node is radioBtnsControl the value output is a variant. When it's radioBtnsControl(strict) it is changing to enum (that's what I want). So I only need to know how I can change a radioBtnsControl into a radioBtnsControl(strict). 


You are wasting our time NOW, but if you actually upload the code so we can look at it, you will NO LONGER be wasting our time.  We want to help, but this is like wanting help from a mechanic but only supplying pictures of your car instead of bringing it in so the mechanic can look at it.

 

(I still have NO IDEA what you are talking about.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 14
(2,532 Views)

give me some time. It's a large vi and if I take out the interesting part, the problem disappears and I would look like and idiot. So I need some time to prepare the code..

0 Kudos
Message 8 of 14
(2,526 Views)

@Robi_F wrote:

give me some time. It's a large vi and if I take out the interesting part, the problem disappears and I would look like and idiot. So I need some time to prepare the code..


That will be perfect.  Take your time.  We also know that sometimes you have to make a mock-up that duplicates the issue.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 14
(2,522 Views)

@Robi_F wrote:

Sorry folks I didn't want to waste your time. I just realised that when the property node is radioBtnsControl the value output is a variant. When it's radioBtnsControl(strict) it is changing to enum (that's what I want). So I only need to know how I can change a radioBtnsControl into a radioBtnsControl(strict). 


Make a separate event case for each one of your radio buttons, and the CtlRef that you are using will be specific to each radio button (strict). 

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 10 of 14
(2,520 Views)