12-15-2022 04:16 AM
Hello Friends,
I want to display three string on one string display depends on three inputs.
if CAB1 button is high sting should display CONTROL-1 and CAB2 button is high string should display CONTROL-2 and if CAB3 button is high string should display CONTROL-3 and if non of the button is high the string should display CONTROL-OFF.
I have attached snippet Please check as it auto display default state after time is over.
or any other idea please share.
Thanks
Solved! Go to Solution.
12-15-2022 06:20 AM
Hi Asif,
Website is not letting me attach any VI so I am attaching some screenshots showing one of the way of a achieving what you need:
Hope this helps.
12-15-2022 07:27 AM
Many thanks
it is working as i want but just one justification that why there is not case # 3?
Thanks again.
12-15-2022 07:27 AM - edited 12-15-2022 07:33 AM
@Asif138 wrote:
Hello Friends,
I want to display three string on one string display depends on three inputs.
if CAB1 button is high sting should display CONTROL-1 and CAB2 button is high string should display CONTROL-2 and if CAB3 button is high string should display CONTROL-3 and if non of the button is high the string should display CONTROL-OFF.
I have attached snippet Please check as it auto display default state after time is over.
or any other idea please share.
Thanks
What should be displayed if more than one button is TRUE? Would a Radio Button control with C1, C2, C3 options and mode set to 0 or 1 selections be better for the User Experience? Might a Enum or Ring be a better option for the indicator?
Myself, I wold try a radio button and a Radio Button value change event reading the Radio button inside that event case. Then just set the indicator value in that event case whenever the user clicks on a button in the radio control. And simply reset the Radio control in the timeout event by writing to its "value (signaling)" property with a property node the property write will also trigger a value change event to automatically update the indicator.
12-15-2022 07:58 AM - edited 12-15-2022 08:15 AM
Hi Asif,
You may want to learn about Binary to Decimal Conversion and that will answer why there is no case #3. If you want to add more possibilities, select those buttons and check for the output number.
001= 1
010= 2
100= 4
011= 3
etc
Also, JÞB has made a good suggestion. Please consider implementing it if your application is supposed to grow more than what you have right now.
Edit: It would be a good practice for long term.
12-18-2022 08:04 AM
Thanks for your replay
actually, this button could never be true at the same time in my project.
Thanks
asif
12-18-2022 09:49 AM - edited 12-18-2022 09:51 AM
@Asif138 wrote:
actually, this button could never be true at the same time in my project.
Well, you really did not explain the entire back story. Where do the boolean values come from? (from some device or from a user input? Why isn't it an array of booleans?)
As has been said, if this is a user input, you should use a radio-button control, else you need to do some conflict resolution to decide what do to if more than one is true by accident. You could even use an integer dial or slide with four positions and text marker label.
If the data comes from an external device that guarantees that only zero or one can be true at any give time, here's what I would do. It is much easier to read and maintain if the strings are not scattered across many cases of a case structure.
(If all possible combinations can exist, it will return the first true found. If you want different strings for all 2^3 possibilities, use the earlier shown code and use an array with 8 elements).