LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behaviour of LoadLocalizedPanel panel

Solved!
Go to solution

Hi ,all:

        When i use LoadLocalizedPanel to make my program with multi-language:

 

void CVICALLBACK menu_English_Select_Click (int menubar, int menuItem, void *callbackData, int panel)
{
	char buf[256] = "";
	char bufABOUT[256] = ""; 

	char tmp[128] = "";
	kal_uint8 strPath [ MAX_PATHNAME_LEN ]; 
	kal_uint32 i;
	
	char    langFilePath[MAX_PATHNAME_LEN];
    int     appLanguage;
    int     panelLLP,dialog, error = UIENoError;

    //if ((GetAppLanguage (&appLanguage)) < 0)
        //return -1;

	appLanguage = ENGLISH;
	
    GetLocalLanguageFilePath (appLanguage, langFilePath);

    if ((error = LoadLocalizedPanel (0, "LEXINTONG_IMEI.uir", panelMain , langFilePath, &panelLLP)) < 0)
        {
        if (error == UIEFileWasNotFound)
            {
            char errBuf[ERR_MSG_LEN];

            sprintf (errBuf, "Error loading panel.  Cannot find the \nlanguage file \"%s\".", langFilePath);
            MessagePopup ("Error", errBuf);
            }
        //return -1;
        }
	
	//DisplayPanel (panelLLP);    if i DisplayPanel that panel,it will make all the control of  mainPanel didn't work
	
	RunUserInterface ();
	
	DiscardPanel ( panelLLP );
}
//-------------------------------------------------------------------------------- 

 

 

if i  'DisplayPanel' that panel,it can changes my program's language,but it will make all the control of  mainPanel didn't work.For example,if i click the button(belong to mainPanel) to select file to open,the String Control can not get that fils' path and if i click button(belong to mainPanel) to do something,it don't effect too.

 

If i annotate it(//DisplayPanel (panelLLP);)  it only changes the menuBar's language and the mainPanel's language not. but all the control of  mainPanel  work properly.

 

why is that problem appears?

 

 

Strage behaviour of DefaultPanel/DefaultCtrl on localized panel
http://forums.ni.com/t5/LabWindows-CVI/Strage-behaviour-of-DefaultPanel-DefaultCtrl-on-localized-pan...

0 Kudos
Message 1 of 3
(3,622 Views)
Solution
Accepted by topic author GD.Huang

This is a callback for some control on an existing panel, right?

If so, you shouldn't call RunUserInterface another time: the problem you are facing could derive from this.

 

Additionally, if you want to localize the active panel, you can simply use LocalizePanel passing the handle of the existing panel, with no need to load it another time: the original panel and the newly loaded otherwise will cohexist both in memory and on screen until you explicitly discard one of them.



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?
Message 2 of 3
(3,613 Views)

Hi,Mr Roberto:

                Thank you for your advice. i have solved my problem.

0 Kudos
Message 3 of 3
(3,595 Views)