LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
AndyRR

Unbundle cluster reference

Status: New

It is possible to trigger an event by a button inside a cluster (LV 2010 at least). However it seems that it is impossible to refer to a button inside a cluster with a reference. One possibility to do that easily would be to unbundle a cluster reference. My suggestion and current situation below:

Unbundle cluster reference suggestion.png

Unbundle cluster reference current situation.png

18 Comments
Intaris
Proven Zealot

1984, please read the posts above.  Stop trolling.

AristosQueue (NI)
NI Employee (retired)

> Passing the references of the individual controls is NOT a good

> solution as a given cluster can have dozens of elements.

 

You are absolutely correct. What you want to define is a good API for a fixed UI target specific to your application. Some solutions that I would recommend instead:

 

1. If you need a fixed UI target. Create an XControl that amalgamates the controls and exposes the properties that you want to be able to manipulate externally. Note that this should NOT include properties like "Inner Numeric 1 Text Color". Instead it should have methods like "Enable Emergency Mode" which, when set to true, the XControl will know to set the Inner Numerc 1 color to red.

 

2. If you need a flexible UI target. Create a class representing an interface to a specific VI. Have the VI be able to generate the class object and populate its private data with refnums. Then expose that class object to callers. Give the class methods like "Enable Emergency Mode" which the class would then execute, and do the appropriate thing for the VI that created the object through dynamic dispatching.

 

Intaris
Proven Zealot

@1984

 

what is the problem with simply "unbundling" the ref of the cluster to the ref of the individual controls


 

 

If you don't know the name of the controls then how on earth do you propose choosing the elements via "unbundle by name"?

If you don't know the order of the controls then how on earth do you propose choosing the elements via "unbundle"?

 

The problems you list with order and name prohibit any correct logical association between the cluster and its contents.  How else do you want the IDE to know which element you want to access if not via index within the cluster (unbundle) or name (unbundle by name)?

alexgieg
Member

Every control's could have an internally generated UUID parameter set when the control is dropped on the front panel. Not like the current UID, which as I understand it requires scripting and is exclusive only to the current running VI, but an actual universally accessible UUID available in runtime. This number shouldn't be changeable, so that the only way to change it would be by replacing the control with another one.

 

Additionally, every control could have a programmer-editable "Tag" field for the sole purpose of identifying that specific control irrespective of index or name changes. This way the user could replace the control (thus losing the UUID) but still keep his code functional if he simply set the new control with the same tag. And tags should be programmatically changeable at runtime.

 

Finally, operations involving accessing controls by reference, including the aforementioned bundling and unbundling of references within references, could be accomplished by allow referring to control's UUIDs or tags.

wiebe@CARYA
Knight of NI

@AndyRR wrote:

However it seems that it is impossible to refer to a button inside a cluster with a reference.

Simply right click the control in the cluster control and select "create reference" creates a reference to the control in the cluster.

 

Absolutely no problem.

alexgieg
Member
Simply right click the control in the cluster control and select "create reference" creates a reference to the control in the cluster.

 

Absolutely no problem.

The problem is when you're trying to read or write to a control on the top VI from several VIs down the hierarchy.

 

Sure, one can create references to several controls on the top VI, build those into a cluster, and pass that cluster to the other VIs, or then rely on the Controls[] property and search for the control by name, but those are repetitive tasks that could receive some "syntactic sugar" treatment so as to relieve developers from having to do make so many clicks when designing complex UI with lots of moving parts.

wiebe@CARYA
Knight of NI

Can't say I have this problem myself very often. I'd wrap clusters like these in a class, as AQ suggests... Even then unbundling the reference to containing references might be slightly useful...

AndyRR
Member

I posted this idea when I had been using Labview for a few months. I'm not longer supporting that this idea should be implemented. I is possible to get references from the controls inside a cluster with the Controls[] property as it has been pointed out here. It's also possible to get the names for these controls which you can wire to a case structure. E.g.:

2017_12_18_get_control_name_inside_a_cluster_front_panel.PNG

2017_12_18_get_control_name_inside_a_cluster.PNG