10-25-2022 04:09 PM
Hello,
I have a cluster with booleans and an Event Structure
These booleans have the mechanical action "Latch when released"
When adding a value change event, the following message is displayed: "Handling a Value Changed event on a Latched Boolean will not automatically trigger its mechanical action. You must read the Boolean's Terminal in order for it to correctly reset"
My doubt: Is there any recommended way to reset the state of these booleans?
Example: The attached vi have five booleans and one Event Structure
10-25-2022 04:37 PM
You could set the mechanical property as switch when released instead, and set the value back to false in the associated event.
10-25-2022 05:35 PM
Instead of one case per control, make one case for the whole cluster. If you register for them dynamically you can then get the CtlRef of the specific one that changed and act accordingly. See this thread:
10-26-2022 07:20 AM
Try this
10-26-2022 12:16 PM
@billko
Set back the value using the Invoke Node "Reinit to Default", a "Local Variable" or the Property Node "Value"?
@BertMcMahan
I need to compare the Property "Label.Text" with the Boolean's name?
And if the boolean label changes, then I have to manually change the name of string in the comparator? Isn't this method too risky?
@paul_cardinale
I think your method works only if all elements in the cluster are booleans, right?
What would you do if the cluster have multiple data type?
10-26-2022 12:24 PM
@paul_cardinale
I think your method works only if all elements in the cluster are booleans, right?What would you do if the cluster have multiple data type?
Works fine. Try it.
10-26-2022 06:13 PM
@mthheitor wrote:
@BertMcMahan
I need to compare the Property "Label.Text" with the Boolean's name?
And if the boolean label changes, then I have to manually change the name of string in the comparator? Isn't this method too risky?
You can compare the label text or you could just create refnums for each element individually and compare the CtlRef from the event node with the refnum constants for each element. You'd end up with something similar to Paul's solution where you are searching an array. It just depends on whatever fits your needs the best.
10-27-2022 01:59 AM
@mthheitor wrote:
When adding a value change event, the following message is displayed: "Handling a Value Changed event on a Latched Boolean will not automatically trigger its mechanical action. You must read the Boolean's Terminal in order for it to correctly reset"
Make sure you read the control, just like it says. E.g. place the control inside the Value change event, then it'll bounce back after being read.