10-11-2021 05:21 PM
I have an array where each element is a cluster of five controls. One of the five controls in the cluster is a Boolean control button. In actuality I am using a Square LED indicator that I converted to a control since it has color and text string properties. In the application the user will press the Boolean control to open or close a physical hardware switch. However instead of just having the control change text and color based on what state the user inputs using the mouse I want to have a DMM confirm the open or closed state of the switch and update the control appropriately. This is easy enough to do with just the two states. However even though the user can only select one of two states the result from the DMM will be tri-state. Less than 5 Ohms is definitely a short. Greater than 100K Ohms definitively an open. Impedances in between will be returned with a warning since there may be a hardware issue. Without the array and just a single cluster alone I can easily do this by changing the background color of the control to red and the text to the warning. The True or False state of the Boolean isn't important when there is a warning so I just set it to False for simplicity.
With no array this is easy to do but once I put the cluster in an array I can't really do this trick anymore since each similar control in the array must have the same ON/OFF colors and text strings. I have fifteen clusters in the array each controlling independent functions. Most if not all will be properly reporting there actual state.
I am considering replacing the Boolean control with a Ring with which I can create three states with. However when I use a ring I come to the problem that only the DMM should be able to place the control in the red warning state while the operator should only be allowed to choose from the two valid states. However as far as I can tell if I disable one of the states of the ring control it disables it not only for a user but also from it being set programmatically. It seems like the only way to do this is to create two separate controls. Is there a better way? Thanks.
10-11-2021 06:56 PM - edited 10-11-2021 07:01 PM
Because an array has to have only different values and not properties, I've had a similar problem before.
What I did is that I made a cluster that didn't look like a cluster, type defined it, and made an array of that instead. The cluster was:
* On top, the control that can be manipulated by the user
* In the middle, a "flat box" decoration stretched beyond the borders of the cluster, colored transparent
* On the bottom, a color box that was also stretched beyond the borders of the cluster.
Then, you read the state of the control, but write the color as a variable instead of a property. The transparent flat box is there so that if the user clicks it, it doesn't click all the way through to the bottom and open up a color chooser window, it just does nothing.
I've attached an example VI showing the idea.
If that's what you're looking for, just go from there. Stick a text box under the flat box too if you want a text string readout, etc.
10-11-2021 08:50 PM
Use a colorbox, where the color is the value (It can be made to look exactly as an LED!) You easily assign a color for each possible state. No property nodes needed.
10-12-2021 10:58 AM
I appreciate the responses. What I ended up doing was taking a suggestion made by PhillipBrooks in the topic "limiting visible enum choices"