05-25-2011 11:01 PM
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):
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
Solved! Go to Solution.
05-25-2011 11:23 PM
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.
05-26-2011 12:51 AM
Thanks, that worked! Here's the working diagram for anyone who's curious.