LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to assign cluster element names programmatically?

Solved!
Go to solution

Hi all,

 

I'm trying to build a data cluster from an array of strings that holds parameter names.  What I'd like to do is stuff the data (numerics) into a cluster, but assign the cluster element names from this array of strings.  I don't want to change the cluster size at all programmatically.

 

I found a post that is similar to my question - http://forums.ni.com/ni/board/message?board.id=170&message.id=358327 - but in my case assigning the captions won't do me much good, as I want to be able to unbundle by the variable name.

 

I feel like I'm missing something obvious, but I've searched quite a bit and come up dry.  Any suggestions?

 

Thanks in advance,

Don

0 Kudos
Message 1 of 7
(11,002 Views)

In a nutshell no.

the name of any control is not editable during runtime.  (I think LV links to the lable in the compiled code) changing a label requires LabVIEW to recompile prior to execution so editing this property during run time "ist strictly verbotten" (not allowed) 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 7
(10,994 Views)

OK, thanks, Jeff.  Of course the answer is disappointing but I can understand the reason behind it.  If anyone else has any comments or suggestions, I welcome them.

 

Cheers,

Don

0 Kudos
Message 3 of 7
(10,966 Views)

You can change the Lable.Text property when the vi is in edit mode (so the code to change the text must be in a different tool-vi).

If you do so, search for darrens nugget on TRef Traverse.vi to obtain the reference of the cluster.

 

But also question what you want to achieve with that. You might be better of by using a Strict Type Def as the cluster, once you change the *.ctl, the lables everywhere you use it will change.

 

Felix

0 Kudos
Message 4 of 7
(10,958 Views)

Hi Don,

do you want to create the cluster to save time while developing, or do you want to change it while the program which work with it is running? If you need it as a development tool, then you can use scripting. I think it should be possible with it.

 

To change it while running is not very useful because you can't change the selected element in the unbundle by name function while it's running.

 

Mike

0 Kudos
Message 5 of 7
(10,957 Views)
Solution
Accepted by drmase13

If you want this at edit time (eg. mass creation of clusters) you can have a look at the following two posts: Description, code example.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 6 of 7
(10,949 Views)

(old thread)

 

But you can set the captions of cluster elements during runtime.

Note that the attached example is with all cluster elements being a numeric.

 

 

Message 7 of 7
(8,726 Views)