LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I programmatically edit items in a Text Ring inside a cluster

I have a text ring inside a cluster array that I would like to change programmatically.  I know how to change the text strings in a ring when the ring control is not inside the cluster. 
0 Kudos
Message 1 of 12
(7,096 Views)

From the FP pop-up on the ring (just the ring!) and select create property node.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 12
(7,091 Views)

And for the more generic solution, you can get a reference to the controls inside a cluster by using the cluster's Controls[] property.

The order of the references is the tabbing order and you can use the To More Specific Class function to cast the reference to your target class.


___________________
Try to take over the world!
0 Kudos
Message 3 of 12
(7,085 Views)
And you can check the Label.Text property to be sure you got the correct item in the cluster!

Best regards,
GerdW


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

But is there a way to directly get ring item text for rings in an array without converting to cluster per below code:

 

array-ring-text.png

Message 5 of 12
(6,605 Views)

@GerdW wrote:
And you can check the Label.Text property to be sure you got the correct item in the cluster!

 

But you do have to be careful with this. If the label changes, the code no longer finds the reference. I prefer Ben's method (not the one listed above Smiley Surprised) of bundling all references into a cluster in an action engine, or a gui manager. I then create a new action for each different gui management action I want to take. The looping through references is definitely a quicker solution, but I like having a cluster with the explicit names of the references, to force any other developers (or myself) to explicitly unbundle the reference they want to use.

Message 6 of 12
(6,601 Views)

Note that when I created the VI snippet, the reference name changed from 'cluster' to 'cluster 2'.  VI snippet must not have been able to determine that the reference was from the cluster.

0 Kudos
Message 7 of 12
(6,589 Views)

If you right click on your array and click Create»Property Node»Ring Text»Text then you shouldn't have convert to a cluster. If you read a string from this property node, it will give you string value of whatever array index is selected.

0 Kudos
Message 8 of 12
(6,565 Views)

If you right-click on the array ELEMENT, you can create a property node to get ring text.  However, you can create a similar property node for the ARRAY of menu rings.   As you can see below, there is no way to get ring text in this case.

 

right-click-on-array.png

0 Kudos
Message 9 of 12
(6,545 Views)

Oh yeah -- sorry about that DonRoth. I understand better what you're trying to do now. I can see how you would prefer not to create a property node for each element in the array.

0 Kudos
Message 10 of 12
(6,517 Views)