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.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Strage behaviour of DefaultPanel/DefaultCtrl on localized panel

Solved!
Go to solution

I am using the localization utility for a multilanguage application I am developing and faced a strange problem.

I can correctly display localized panels but if I happen to call DefaultPanel on the localized panel, all text messages return to original (untranslated); the same happens if I call DefaultCtrl on a text message. Control labels are not affected by this problem.

The problem happens both if I use LoadLocalizedPanel and if I call LoadPanel + LocalizePanel.

 

This behaviour is particularly annoying as I sometimes call DefaultPanel to revert all controls in a panel to their default value. Having observed this fact, I can only use as a workaround a loop on all panel controls to default all but text messages (haven't tested on rings on till now).

 

Tested on CVI2009SP1 and 2012SP1, on a Win7 machine. This happens both in the IDE and in the compiled executable.

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 1 of 3
(3,611 Views)
Solution
Accepted by topic author RobertoBozzolo

Hi Roberto,

 

Unfortunately, this is a consequence of the localization library being a component that sits on top of the UI library, rather than part of the UI library. The UI library doesn't know anything about the localized strings and so when you call DefaultCtrl, the control's value reverts to what it was in the .uir file. And the translated strings were set by simple SetCtrlVal-type calls in the localization library -- undistinguishable, as far as the UI library is concerned, with your own SetCtrlVal calls in your own program.

 

This could also happen to controls other than text messages: strings and text boxes, for example. The only reason it doesn't happen with all control types is because in most cases, the translated strings are not part of the control's "value". Instead, they are simply attributes (the label text, for example). And DefaultCtrl / DefaultPanel affects only values, not attributes.

 

If you don't want to iterate through every control looking for controls that you can or can't call DefaultCtrl on, you should also be able to get around this limitation by calling DefaultPanel followed by LocalizePanel. Would that not work for you?

 

 

0 Kudos
Message 2 of 3
(3,602 Views)

Well, I suppose it can work for me, or at least having you clarified which is the mechanism that lies under the localization tool I can develop an appropriate strategy to address this topic.

 

It turn out infact that control default value can be different from what happens localizing a panel: while generating the translations in the localization utility I can add some text in the value field of string controls, for example, and have it displayed when calling LocalizePanel. However, in this particular case this can be different from what I obtain with DefaultCtrl.

 

Now that I have understood how the localization utility works, I can tailor the application to my needs. Thanks for your help.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 3
(3,596 Views)