LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Latch mechanical action not working for boolean inside an array of cluster

Solved!
Go to solution

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

 

 

 

 


0 Kudos
Message 1 of 7
(5,267 Views)

@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.

 

 

Regards
Freelance_LV
TestAutomation Consultant
Message 2 of 7
(5,260 Views)

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.

 

Array_of_Cluster.png


0 Kudos
Message 3 of 7
(5,248 Views)
Solution
Accepted by topic author SeanDonner

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(5,244 Views)

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

0 Kudos
Message 5 of 7
(4,269 Views)

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.

0 Kudos
Message 6 of 7
(335 Views)

@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.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 7
(328 Views)