06-25-2009 03:57 PM
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
Solved! Go to Solution.
06-25-2009 04:12 PM
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)
06-26-2009 06:26 AM
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
06-26-2009 06:36 AM
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
06-26-2009 06:37 AM
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
06-26-2009 06:47 AM
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
05-06-2016 01:30 PM
(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.