LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Application localization in one function

> Also, just in case you didn’t know already, control fonts can be changed programmatically, using the SetCtrlAttribute() function.  This should keep you from having to rebuild your entire UI with a new default font.

Does LabWindows/CVI have something like collection objects (like in Microsoft office)?

If it had I might have used construction like this for every panel:

for each <object> in <collection> do

...

end for

0 Kudos
Message 11 of 19
(2,064 Views)
CVI does not handles collection objects, but you can easily create a function that iterates on all controls in a panel and applies proper attributes to some of them. Here a skeleton code of a function I am using to accomplish a similar task:
 
int  next;

GetPanelAttribute (panelHandle, ATTR_PANEL_FIRST_CTRL, &next);

// Iterate through all controls on the panel
while (next) {

 // Determine the control style and apply the attributes to specific ones
 GetCtrlAttribute (panel, next, ATTR_CTRL_STYLE, &style);
 switch (style) {
  case CTRL_STRING:
  case CTRL_STRING_LS:
      // Apply font attributes
      SetCtrlAttribute (......);
      break;
  default:
      break;
 }
 GetCtrlAttribute (panel, next, ATTR_NEXT_CTRL, &next);
}

 


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 12 of 19
(2,062 Views)
If you can recreate the problem, and post the steps to do so (allong with any necessary files), we would like to take a look at it.  Thanks!
Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 13 of 19
(2,042 Views)

Something strange occurs with panel localization.

I note that this problem occurs only with controls of "message text" type.

 

On CRMS_File_man_set.JPG the english version of panel is shown.

On CRMS_File_man_set_01.JPG the translated version of panel is shown as it displays in CVI GUI Localization Utility.

On CRMS_File_man_set_02_1.JPG the translated version panel is shown as it displays in the running program.

 

There are the appropriate strings of ui_Russian.lwl file (The file is written correctly).

 

[FSAVE_TEXTMSG_3]
Type = 4
Flags = "@f"
Default = "Запись данных"

[FSAVE_TEXTMSG_9]
Type = 4
Flags = "@f"
Default = "Выбор источника данных"

[FSAVE_TEXTMSG_11]
Type = 4
Flags = "@f"
Default = "Усреднение данных"

 

Why doesn't this panel display correctly in the running program?!! Smiley Sad

 

0 Kudos
Message 14 of 19
(1,973 Views)

Addition:

 

I made this steps :

 

1) Recreated the ui_Russian.lwl file

2) Removed the old file from the project and added the new one

3) Recreated Debuggable Executable

4) Run the program (Shift+F5)

Message Edited by stskr on 08-27-2008 08:51 AM
0 Kudos
Message 15 of 19
(1,971 Views)
As I understand, the problem is that when changing file ui_Russian.lwl changes do not affect the panel in Menu.uir , even if I delete this file from the project and then added again.
If I change Menu.uir manually, changes are displayed correctly (except localization).
Why is this happening?
0 Kudos
Message 16 of 19
(1,945 Views)

Hello stskr,

How are you invoking the LocalizePanel( ) function?  I have tried this on my own machine, creating a .lwl file with the localui.exe utility, verifying that the changes occur at run-time, and then changing the .lwl file and verifying once again that the changes take place at run-time.  I included several different controls on the UIR (including the "Text Message" type), and did this in both versions 8.0 and 8.5 of LabWindows/CVI.  Have you deleted/added controls to the .uir file since creating the .lwl?  Also, are you exporting the .lwl and .lwd files from the localui.exe utility after making the necessary translations? 

If you have deleted/replaced any of the controls on the UI, then you will need to re-create the .lwl and .lwd files with the utility...

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 17 of 19
(1,911 Views)

Have you deleted/added controls to the .uir file since creating the .lwl? 

Also, are you exporting the .lwl and .lwd files from the localui.exe utility after making the necessary translations? 

If you have deleted/replaced any of the controls on the UI, then you will need to re-create the .lwl and .lwd files with the utility...

 

I did the following steps:

1) Recreated controls in the panel in the .uir file.

2) Saved this .uir file 

3) Loaded the .uir file into the localui.exe utility

4) Imported the old lwd files

5) Added translations in Russian of new texts

6) Exported the lwd and the .lwl file  

7) Added the .lwl file into LabWindows/CVI

😎 Builded .exe file

9) Ran the program (Shift+F5)

 

Then I see now:

1) Some of translated texts replace other controls!

2) In English version of the program I see the new controls in Russian inspite of other controls are in English!

 

I use 8.0.1 version of LabWindows/CVI.

0 Kudos
Message 18 of 19
(1,899 Views)
stskr, It sounds like you may be accessing the wrong .lwl file from your LocalizePanel( ) function call. I would recommend creating a brand new .lwl and .lwd file from the utility, and then making sure that you call the correct .lwl file from your LocalizePanel( ) function call. Also, you should not have to add the .lwl file to the project. Try hard-coding the path to the correct file to be sure you are calling the one that you believe you are. If you continue to see issues, feel free to post your UIR, .lwl, and .lwd files and I would be happy to take a look at them for you.
Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 19 of 19
(1,871 Views)