LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get label of button's containing cluster?

Solved!
Go to solution

Given the reference to a button control within a cluster, how can I get the label of the containing (parent) cluster?

 

More details on the task at hand:

I have a pair of buttons ("read" and "write") inside a cluster, which I have repeated in rows, and then wrapped in another cluster for layout convenience. I now want to handle the events of each button, grouped by row and column, as pictured (VI also attached):

 

ButtonInCluster.gif

 

My aim is to have a "read" event case, and a "write" event case, and based on which row-button is pressed, the code will index an array of data for the read and write operations. I know that I could write separate events for each, or change the labels of each button to "Read Button 0", "Read Button 1", "Read Button 2", but this is just an illustrative example for a much larger grid of buttons and other controls, and it is prohibitive to have to turn each of the labels on, then alter them, then hide each of the labels.

 

If this isn't possible, I'm open to other ways to approach this problem that don't involve copy pasting event cases for each row (since that's also prohibitive for how frequently the cases are modified).

 

Thanks in advance,

Arthur

0 Kudos
Message 1 of 3
(2,995 Views)
Solution
Accepted by topic author Artybear

You can use the property node of the button object called "owner".  What it does is return a reference to the owning object of that button, in this case the cluster.  Then you can cast that reference to a more specific class of cluster.  Then use a property node on that to read the label.text.

Message 2 of 3
(2,993 Views)

Thanks, that worked! Here's the working diagram for anyone who's curious.

 

ButtonInClusterNew.gif

Message 3 of 3
(2,986 Views)