08-14-2012 05:37 AM
I'm currently on LabVIEW 2012.0f1 and I noticed that if you were to create a cluster typedef that has a boolean control with the latch mechanical action and then put said cluster inside an array, the boolean will act as a switch instead of a latch if read in a loop or event structure. Is this a bug or expected behavior? Regardless of the answer, how do I get my desired behavior of latching action?
Thanks
Solved! Go to Solution.
08-14-2012 06:56 AM
@SiegeX wrote:
I'm currently on LabVIEW 2012.0f1 and I noticed that if you were to create a cluster typedef that has a boolean control with the latch mechanical action and then put said cluster inside an array, the boolean will act as a switch instead of a latch if read in a loop or event structure. Is this a bug or expected behavior? Regardless of the answer, how do I get my desired behavior of latching action?
Thanks
Hi
when a boolean control is placed inside a cluster, it acts like a switch and not a latch, irrespective of the mechanical action setting.
I cannot provide the logical reasoning, but it is the fact. i have worked around this behavior lot many times.
the only solution i see is, to reset the button again, as soon as the event is detected. so, inside the event case, write a negation of the new value (or the old value output simply) to the boolean control. that is if you want to use the latch action, even though it behaves like a switch
even if you use the property nodes of such a cluster object, you would get a variant data type for the Value property.
else, you can set the mechanical action to 'switch when released' and proceed.
08-14-2012 01:12 PM
Freelance LV wrote:when a boolean control is placed inside a cluster, it acts like a switch and not a latch, irrespective of the mechanical action setting.
The behavior I see is that a boolean latch inside a bare cluster control works just fine, its only when you put that cluster into an array does the mechanical action go from latch to switch (see attached snippit). It sure seems like a bug to me considering that it works as a latch inside the bare cluster. I do appreciate the work-around tip, however.
08-14-2012 01:26 PM - edited 08-14-2012 01:27 PM
I don't think it's a bug. It is consistant with an array. If you put a button inside of an array, you cannot set its mechanical action anymore.
10-15-2015 07:40 AM
I needed such action; I have array of clusters containing boolean controls. The information I needed was index of clicked booelan. Setting default value of boolean to False and reinitilizing inside event case yielded a proper approach for my application. One can use attached snippet if similar action is needed...
Palazzo
01-11-2024 04:54 AM
Hello guy! I have a similar problem. I have an array cluster of boolean, and I want when I pressed a button from array, it return to the initial value and I don't want it to stay activated.
01-11-2024 05:38 AM
@Costin2001 ha scritto:
Hello guy! I have a similar problem. I have an array cluster of boolean, and I want when I pressed a button from array, it return to the initial value and I don't want it to stay activated.
The obvious solution is to manage the Value Change event of the array control, get the NewVal and reset to false all button boolean values, then write the result back to the control. Optionally you can check if any of the buttons value changed to true before doing this.