01-24-2014 12:26 PM
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?
Solved! Go to Solution.
01-24-2014 12:32 PM
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.
01-24-2014 12:52 PM - edited 01-24-2014 12:56 PM
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 🙂
01-24-2014 01:10 PM - edited 01-24-2014 01:11 PM
I dont think you can change the caption of a normal typedef or a strict typedef. During runtime 🙂
01-24-2014 01:21 PM - edited 01-24-2014 01:22 PM
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
01-24-2014 01:42 PM
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.
01-24-2014 01:43 PM
Here you can do something like this before runtime. 🙂
After that use VI scrpting to edit the words.
Then Magically when you open the previous menu.
You'll also notice that i used labels.
01-24-2014 01:47 PM
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.
01-24-2014 01:52 PM
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.
01-24-2014 01:56 PM - edited 01-24-2014 02:01 PM
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 ?