LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting and applying a value change of a control in a cluster which is an element of a array (example VI attached)

Solved!
Go to solution

Hey folks, 

 

first off, thanks for all the help/idea/suggestions you've given me before.  many kudos given.

 

The problem I'm currently stuck on is fairly simple to understand if you can afford to ttake a look at the VI im attaching.

 

I have an array in my UI whose element type is a cluster of several controls.  On the UI of my actual app (and also the example vi I made) There is more than one element shown at a time in the array.  The array size is fixed, there are 8 elements visible whose individual controls are changed by the user.  

 

I figured out how to get the name of the control I've changed the value of inside the element, but I don't know what element it was changed in.  I was hoping the solution could be easier than dealing with the coordinates of what element was changed... I'm aiming for scalability here.  Do any of you labviewers know of a prop node or somehting that will give me an indication of what elem changed?

 

Thanks again!!

-pat

 

ps vi attached is 2011

0 Kudos
Message 1 of 13
(3,457 Views)

I was going to whine that the answer can be found with search, but I can't find it in search!

 

One way is to keep the array value in a shift register and compare the previous values with the current values.

Message 2 of 13
(3,447 Views)

Since you have the array of control references why not search the array for the reference provided in the array. This should give you the position of the specific cluster that was modified.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 3 of 13
(3,445 Views)

Oops, sorry, I should type slower. 😞

I can't get the ref to equate. Value comparison still works, though.

Message 4 of 13
(3,441 Views)
Mark, that is an awesome idea! Ill try it out as soon as i get into work tomorrow. Thabks! Why cant i get LV2011 On my galaxy note?
0 Kudos
Message 5 of 13
(3,432 Views)

Mark- I tried what you said in this vi (I think this is what you meant, please correct me if not), but it seems the reference for each element is the same... which makes sense after I executed it because the ArrElm is cast down to that type element.

 

EDIT (scratch the attachment)- I reread your explanation and realize I implemented it wrong.  Sorry about that.  You're talking about using a property node to get the position of what the ref points to right?  I was hoping to stay away from position because I would like to have this be scalable - that way in the future if the number of controls that need to be in the array goes from 8 to 256 the code won't need to be modified too much.  However, if there's no simpler way, then I just gotta do what I gotta do huh...

 

 

Todd- what do you mean by value comparison?

 

Thanks for the help I really appreciate it

 

-pat

0 Kudos
Message 6 of 13
(3,417 Views)

Can you guys take a look at this picture and tell me why this isnt working?  maybe it something real stupid im missing here, but based on what the probes are reporting shouldnt this work?!?!

 

thanks again

 

-pat

0 Kudos
Message 7 of 13
(3,407 Views)
Solution
Accepted by topic author plyons.gks

Here's a different (and working) approach.  No need for the complicated dynamic event registration.  See image below.

ValChangeEventInArray.png

The Variant functions (GetClusterInfo and GetTypeInfo) are from vi.lib\utility\VariantDataType.

Message 8 of 13
(3,404 Views)

@PatLyons wrote:

Can you guys take a look at this picture and tell me why this isnt working?  maybe it something real stupid im missing here, but based on what the probes are reporting shouldnt this work?!?!


It is working, it just isn't doing what you want.  You're getting the index of the element within the cluster that changed, whereas what you wanted was the index of the array element that changed.

Message 9 of 13
(3,400 Views)

After realizing this I'd be lying if I said I wans't embarrassed Smiley Frustrated

 

Thanks for the help!

 

-pat

0 Kudos
Message 10 of 13
(3,379 Views)