LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I retrieve reference names from a type def cluster

Hi all,
 
Does anyone know a good way of retrieving reference names from a type def cluster, so as the name of each reference will appear in unbundle by name?.
 
I know you can create an array of references, and an array of corresponding reference names, but this is not what I am after. I have read that it can be done by casting each individual reference to a more specific class, then retrieving the name by property node, but again this does not give me a bundle of named references.
 
If I typecast the control[] array to the original type def, It almost works, as I get a bundle of named references, but the order can be wrong and so the names don't always match.
 
Does anyone know a solution to this frustrating problem?
 
John   
Certified LabVIEW Architect
0 Kudos
Message 1 of 7
(2,531 Views)
John,

I am not sure I understand the part about the order being wrong and the names not matching. The order may be the creation order or the tabbing order of the cluster. It almost certainly is not related to the position of the control within the cluster, unless the components were placed in a top to bottom or left to right sequence as created and never moved or reordered.

The Label of a control is the name which is associated with it. That cannot be changed programmatically and the property node should return it. The display, however, may be the Caption which can be changed. The caption is also accessible via property node if it has been created from the front panel.

Can you post a simple example which exhibits the problem you are having?

Lynn
0 Kudos
Message 2 of 7
(2,516 Views)

Hi Lynn

Here is a jpg of the problem

Certified LabVIEW Architect
0 Kudos
Message 3 of 7
(2,510 Views)
John,

I think it will be difficult to get it working and to maintain it over changes. You would need to keep the panel order and the order within the cluster synchronized.

What is the purpose of your listbox of control references? What are you trying to do? Maybe someone will be able to offer an alternative approach which accomplishes you end goal.

Lynn
0 Kudos
Message 4 of 7
(2,504 Views)

The aim is have access to all control references on the GUI FP so that settings can be written directly to them from aywhere in the main.vi code

Many thanks for the feedback, I dont think im too far away from finding a solution.

John

Certified LabVIEW Architect
0 Kudos
Message 5 of 7
(2,494 Views)

I understand why you like the Controls[] method, but I would avoid it as it is ambiguous and has the potential for breaking.

I suggest you do something like this maybe.


___________________
Try to take over the world!
0 Kudos
Message 6 of 7
(2,486 Views)
John,

You don't really need a cluster of control references on the front panel. Just pass around the array of Controls[] references from the property node. If you match labels you can determine which reference belongs to the control you wish to change. In subVIs you can use the Call Chain or VI Server Reference nodes to obtain references to the main VI front panel.

Be aware that using references in a subVI can cause a switch to the UI thread. This can have a performance impact.

Lynn
0 Kudos
Message 7 of 7
(2,486 Views)