LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create label programatically- config file



@johnsold wrote:
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

I have LV 8.2.  I can create a property node for caption visible and for label visible.

Message Edited by Ravens Fan on 04-24-2007 11:11 PM

0 Kudos
Message 11 of 15
(2,034 Views)
I know about those property nodes. If the caption has not been made visible manually first, that node will return the 1320 error. Try this:

Create a new VI.
Drop a Numeric control on the panel.
On the block diagram create a property node for numeric with Properties: Caption.Visible, Caption.Text, and Label.Visible.
Change all to write.
Set: Caption.Visible <- True
Caption.Text <- "Hello"
Label.Visible <- False
Connect the property node error out to an indicator.

Run the VI.

The label stays visible and error 1320 is returned.

From the front panel select Visible Items >> Caption. Then select Visible Items >> Label so both are shown. Run VI again. Now the label disappears and the caption changes to "Hello".

Can you get the caption to show up without the manual step?

Lynn
0 Kudos
Message 12 of 15
(2,023 Views)
Hi Lynn,
 
I didn't mean to make it sound like you weren't aware of those property nodes.  By your bars, I know you are an experienced LV programmer.  Sometimes there are so many options on those create node menus that you don't see all the choices that are there.
 
I went through the steps you listed and I did get that error number 1320.  I just let it pop up a dialog box and got this text. " Error 1320 occurred at Property Node (arg 1) in Untitled 1.vi
LabVIEW:  In run mode, LabVIEW cannot get or set a property for a control part that has not been created."
 
Could this be considered a bug?  Why would it allow you to create a property node for a control part that hasn't been created?  It's in the menu, and it's in the right click properties dialog box.  Even if it hasn't been selected in the dialog box before, it is still existing in the control, right?
 
I found a few other interesting behaviors.  If I rearrange the order of nodes so that caption.text is set first, then the error arises on that.  If I go into the property dialog box, and change the text of the label from Numeric to Numeric1, but don't touch anything about the captions, then no error is generated and all the property nodes get set programmatically.
 
I tried creating a boolean control.  I changed the name of the control from Boolean to 123 by editing it on the front panel.  I set the property nodes to point to that instead of the numeric.  I ran and got the error.  When I created the control and edited the name by way of  the dialog box, then no error when I ran it.
 
Also the code, the caption came up as white text on a black background.  If I dragged the caption around, I got some grey shaded boxes appearing.  Sometimes, the caption would correct itself by clicking and moving things around.  Graphic anomalies?  See attached.  I did some customizing of the controls to see if that affected the setting of the property nodes.  It didn't seem to help the errors at runtime.
0 Kudos
Message 13 of 15
(2,008 Views)
I can confirm what you said about the Properties dialog. Strange!

I tried moving the position of the label and making invisible first, then doing something with the caption. Still produces error 1320. Tryning to get a reference to the caption generates error 1055 Object reference is invalid.

Having caption properties set to read and with nothing wired to them does not produce the error. Is the compiler smart enough to not do anything with a property which is not connected?

Lynn
0 Kudos
Message 14 of 15
(2,002 Views)

"Is the compiler smart enough to not do anything with a property which is not connected?"

Yes! Same applies to functions that return a value but are un-wired.

Gotta watch that when doing bench-marks.

There maybe an exeption to the caption behaviour when it is wired to the icon connector since the labels shown when flaoting are really the captions.

The errors mentioned above are "by design" as of LV 7.0 (?).

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 15 of 15
(1,996 Views)