10-26-2013 04:20 AM
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...
Solved! Go to Solution.
10-26-2013 04:44 PM
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.
10-27-2013 11:09 PM
Hi,Mr Roberto:
Thank you for your advice. i have solved my problem.