From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event based radio button control

Solved!
Go to solution

Is there an easier way to write this code and keep the same functionallity?

0 Kudos
Message 1 of 6
(3,982 Views)

Would this work?

radio buttons.png

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 2 of 6
(3,961 Views)

Is there any reason you don't simply customize a radio button indicator to match your large booleans?  Your code becomes a simple wire.  I'm guessing that this is just an example of what you're trying to do, and not the end-product you're making.  Why do you need boolean indicators of a boolean control?  You're adding extra objects to the front panel without adding any extra information.

 

RADIO%20BUTTON%20EXAMPLE[1].png 

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 3 of 6
(3,953 Views)

Thanks for the replies. Sorry if I was not clear. The indicators (big) are only indicative of the function I was looking for. I am having to send a radio button control signal down through a class - actor loop from the UI to the RealTime control on cRIO and back to the UI. The loop and communication I have done but for some reason the radio button has a weird functionality where it only shows one true/false value through the loop and back up to the UI.

 

meaning - 

 

in the example the radio button has two controls radio 1 and radio 2. when they switch between the two I get the true/false value of only radio 2. so it signals radio 2 is true when radio 2 is on, and radio 2 false when radio 1 is on. As seen with a probe on the array wired into the for loop.

 

the value does change on NewVal line between radio 1 and 2 but when it is broadcast to the cRIO it shows only the value of radio 2 as being true/false. This is fine for the output channel as they energize correctly. (two different outputs) but It does not allow me to use the broadcast data back to the UI in the same way as if it were two booleans, not one radio button.

 

so in short I was trying to figure out a way to get the radio button to act llike a radio button on the front panel but act like two booleans on the return trip...

 

I hope that makes sense. Unfortunately, I can't supply code for the program (proprietary development) hence the example of functionality. (pretend the indicators are on the return loop)

0 Kudos
Message 4 of 6
(3,932 Views)
Solution
Accepted by topic author Gearmiester

Just use number to boolean array 

Capture.PNG

The method works if you do not allow zero items NOTE: Do not replace the Add 1 with increment.  We are using the U32 constasnt to coerce the radio button enum otherwise the incrment just inverts the enum; enum(0,1)++ = enum(1, 0) and enum(0,1)+1= U32(1,2)

If you do allow zero items remove the addition since "no selection" becomes 0


"Should be" isn't "Is" -Jay
Message 5 of 6
(3,909 Views)

Jeff~

 

Thanks for that - it works with the boolean value and is much simpler to impliment. Though it did not solve all the issues I found a good work around. I believe the issue I am really having is the fact that I need both the name of the button and the value to travel the loop (DO and Status) The conflict I believe is coming that I am using a radio button control and an enum type def with all the DO names.

 

the issue is that the trype def does not change the value of the radio button name with the boolean value hence the radio 2 value shows true when radio 2 is on and false when radio 2 is off.

 

here is a snippit with a variation of your solution.

0 Kudos
Message 6 of 6
(3,839 Views)