LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Select a cluster in an array of clusters

Solved!
Go to solution

I would like to be able know which cluster was changed in the array of clusters. The user can change any cluster now, but I would like to limit it to one cluster and pass that cluster back as an output. Is there a way to know which array element is selected? If so, I could create a sub-VI that would show and allow the user to change that cluster. It would be best if I could get the array index when displaying an indicator array instead of a control array.

Download All
0 Kudos
Message 1 of 7
(2,927 Views)

Just compare the previous array value to the current using a Equals set to Compare Elements (right-click option).  Then use Search 1D Array to find the first FALSE value.  You now have the index of the changed cluster.


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 2 of 7
(2,926 Views)

I would like to be able to change one cluster at a time. 

 

I am actually displaying an array of indicators. Now, I can use a Mouse Down event to select the entire array, but I cannot figure out how to know which cluster was clicked on. The code snippit that I attached was the sub-VI called by the event handler.

0 Kudos
Message 3 of 7
(2,917 Views)

Hi Steven,

 


@StevenHunter wrote:

I would like to be able to change one cluster at a time. 

 

I am actually displaying an array of indicators. Now, I can use a Mouse Down event to select the entire array, but I cannot figure out how to know which cluster was clicked on. The code snippit that I attached was the sub-VI called by the event handler.


Present this array of clusters as a (multicolumn) listbox to the user.

When the user selects an item in the listbox you get the value of the listbox to index your cluster from the array for further manipulation…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(2,907 Views)

First you said you wanted to know which culster (i.e. array element) was changed, later you said you wanted to know which element was "moused".

 

For a value change, here's what I typically use with arrays of mixed clusters:

 

altenbach_0-1585001008917.png

 

Message 5 of 7
(2,858 Views)

The reason that I suggested a mouse-down to select a cluster to edit with another VI is that some of the cluster elements are strings. They give an event for every keystroke if you use Value Change events.

 

The suggestion to use a Multicolumn Listbox is interesting also. There is a Focus Row property that can be used to index the correct cluster, if I can just figure out how to use a Multicolumn Listbox. I had not heard of them before today.

0 Kudos
Message 6 of 7
(2,837 Views)
Solution
Accepted by topic author StevenHunter

@StevenHunter wrote:

... some of the cluster elements are strings. They give an event for every keystroke if you use Value Change events.

 


Only if they are configured to "update while typing", though.

Message 7 of 7
(2,832 Views)