LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

strict typedef to typedef by scripting

Solved!
Go to solution

Hello,

 

I have problem when Ito cones to create Caption in strict typedef programaticaly - it seems that I cant do that. When I am operating on normal typedef it works good.

I can do it manually because there is only 4 or 5 that strict typedefs.

I am beginner when it comes to scripting, Do You have any suggestions? 

 

0 Kudos
Message 1 of 11
(3,458 Views)
Solution
Accepted by pawhan11

I think you need a little more discription.

 

Are you trying to change the caption before runtime our during.

 

by scripting do you mean Labview Script? creating new controls for use during runtime. 

 

If your trying to create a nice looking control from a typedef, maybe you should look at xcontrols. Then you can use a property node to change the caption/labels.

0 Kudos
Message 2 of 11
(3,452 Views)

sorry, I clicked wrong button and I gave solution 😄

 

I am changing caption during run time and that is solved and it works if caption is arleady created.

 

I need to make language localisation for project. This project is old and isn't done by me from beginning. 

It has many controlls tabs and so on.

I have managed to get all references.

Some controlls do not have created caption. So I need to create caption for each controll, and I can do that when controll isn't strict typedef.

So I need way around to create caption for strict typedef in order to continiue rowking on translation 🙂

 

0 Kudos
Message 3 of 11
(3,439 Views)

I dont think you can change the caption of a normal typedef or a strict typedef. During runtime 🙂

0 Kudos
Message 4 of 11
(3,426 Views)

I can because It seems to be working. 🙂 I just can't create them in runtime.

 

I just don't know how to create caption in strict typedef [ this can't be done in runtime ] programaticaly

0 Kudos
Message 5 of 11
(3,416 Views)

Use the standard algorithm for scripting - how would I do it in the UI, then translate to scripting.  In this case, you create the caption by setting its Visible property to TRUE.  You can get to this from the reference to the control on the typedef (Caption.Visible).  The caption does not exist unless it has been made visible.  It is created at that point, if needed, but only in the dev environment.  If you try to set this property in the run-time, and the caption does not exist, it will fail.  Once created, the only way to delete a caption is to delete the control.

0 Kudos
Message 6 of 11
(3,403 Views)

Here you can do something like this before runtime. 🙂

Before.png

After that use VI scrpting to edit the words.

Code.png

Then Magically when you open the previous menu.

After.png

 

You'll also notice that i used labels.

0 Kudos
Message 7 of 11
(3,402 Views)

Labels and captions are treated very differently by LabVIEW.  The label of a control is its identifier and is used for things like cluster names.  The caption is simply a text string associated with the control.  As such, labels cannot be changed at runtime, since changing them would require a recompile.  Captions, however, can be changed at runtime (provided they exist) making possible such things as localization and changing the function of a control.  For real-world GUIs, it is suggested that all controls show captions and hide labels for this very reason.

0 Kudos
Message 8 of 11
(3,396 Views)

I would defiantly agree, changing captions wont break things. Changing labels however is quite a different affair.  I just wanted to point out that if you us vi scripting it will not work with built applications. So unless you want to make a different build for each localization it wouldn't be the way to do it.

0 Kudos
Message 9 of 11
(3,389 Views)

Hmm,

 

I am doing in the same way like You showed but I was working on main VI, not on typedef controll itself.

If I create this caption in strict typedef/typedef ctl file and save it,

now when I open main VI caption in this strict typedef should be creatad and all sohuld be working fine.

 

But isnt it safer to change captions rather than labels? As far as I know caption is only text so changing that is 100% safe, but changing label may break code that programmatically refers to that controll by name ?

0 Kudos
Message 10 of 11
(3,381 Views)