From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create label programatically- config file

How can the string values be programatically set to labels for booleans. A 2D array of strings contains the 1st column as string(which are to be places as labels), and the second column are the values (which gets parsed as boolean).
Using the config file functions, the value is obtained as boolean from the second column, is it possible to set the string in the first column as the label for the values - both are on same rows.
 
Any suggestions?
 
TIA
0 Kudos
Message 1 of 15
(3,455 Views)

The way I've done this is to hide the label and show the caption on the front panel.  Then write the 1st column (label string) to a property node that writes the caption value.  (Actually caption.text value)

Tom

Message Edited by Tom Haggerty on 04-11-2007 10:04 PM

0 Kudos
Message 2 of 15
(3,441 Views)
Hi,

As Tom recommended, using the caption is the way to go. Per this knowledgebase article, Programmatically Changing the Label for a Control or Indicator in LabVIEW , changing owned labels at run time is not possible, and you must instead change the caption.

Kind regards,
-Sam F, DAQ Marketing Manager
Message 3 of 15
(3,418 Views)
Hello Tom and Sam,
 
Thanks for the suggestion and I believe that is the way to go. But in my application there is a little more to it. Please see the attached caption.doc. In the loop a string is read and bool is the value read. The bool value read should have the caption as read from string.
Even after setting it in the loop the caption is not applicable to the array outside the loop and to the cluster Bool_array_with_caption.
How to set these?
 
Thanks. 
0 Kudos
Message 4 of 15
(3,397 Views)

I worked on a simple solution for about an hour this morning but could not get it to work!  I think the solution may not be so simple.  I'm sorry but I have a lot of other work to do today so if no one else has an answer I can look into it again tomorrow.  The problem is going from a single element to a cluster to an array.  The element in the cluster in the array is the one that needs the caption changed.  So it may need to be done after the array is built in a seperate for loop or sub vi.

 

Tom

0 Kudos
Message 5 of 15
(3,374 Views)

Thanks Tom,

I appreciate your response...will try out your suggestion(loop or subVI)...but feel it will be the same result after the enable index (at least for the loop).

 

0 Kudos
Message 6 of 15
(3,362 Views)

I have a working model that you can start from.  I have a question -- I tried to simulate kind of what you were doing and I had to set the size of my cluster in the array to cluster to 5 -- Do you have a fixed array that you are building into a cluster?  If not, --- if the array is always a different size, I think the array to cluster will not work.  Any way, I created the cluster indicator and had to change all the booleans visible items inside from label to caption.  I had to do each one.  Then I ran this vi and all the captions changed on the cluster to what was written in string.  So this basically does what you want!

 

Tom

Message 7 of 15
(3,335 Views)

Thanks Tom,

I have set the cluster size to max as they are of different size. The example you provided works perfectly.

Thanks again for the help!

SE

0 Kudos
Message 8 of 15
(3,287 Views)

Excellent -- Glad I could help!

 

Tom

Message 9 of 15
(3,270 Views)
Be aware that you need to manually make the caption visible at edit time. If you have never done this for a particular control, the Caption.text property node returns error 1320. If there is a way to programmatically make the caption visible, I have not been able to find it.

Lynn
Message 10 of 15
(3,258 Views)