03-27-2012 06:31 PM
I have two child panels
errChk( gMainWindow.panel = LoadPanelEx(0, "test.uir", MAINPANEL, __CVIUserHInst));
errChk( gMainWindow.instrTab = LoadPanelEx(gMainWindow.panel, "test.uir", INSTRTAB, __CVIUserHInst));
errChk( gMainWindow.statPanelTab = LoadPanelEx(gMainWindow.panel, "testStat.uir", STATTAB, __CVIUserHInst));
I use the EasyTan_AddPanels
errChk( EasyTab_AddPanels(gMainWindow.panel, MAINPANEL_CANVAS, 1, gMainWindow.instrTab, gMainWindow.statPanelTab,0));
Now when I try to use ResetTextBox() it returns error "The control is not the type expected by the function. Although the SetCtrlVal() work if I comment out the ResetTextBox() . What am I missing?
Here is the code:
case 10001: //
// Get String data
tsErrChk(TS_UIMessageGetStringData (uiMsg, &errorInfo, &uiString));
ResetTextBox (gMainWindow.statPanelTab, STAT_MAIN_STATUS, "");
//Display the parsed string as received
SetCtrlVal(gMainWindow.statPanelTab, STAT_MAIN_STATUS,uiString);
break;
Solved! Go to Solution.
03-27-2012 07:09 PM
I tried by adding the GetPanelHandleFromTabPage() and error returns on this call stating "The control is not the type expected by the function". Not certain what control is it looking for? If I use the controlSTAT_MAIN_STATUS which is on gMainWindow.statPanelTab, same error.
case 10001: //
// Get String data
tsErrChk(TS_UIMessageGetStringData (uiMsg, &errorInfo, &uiString));
GetPanelHandleFromTabPage (gMainWindow.panel, MAINPANEL_CANVAS, 2, &stat_PanelHandle)
ResetTextBox (stat_PanelHandle, STAT_MAIN_STATUS, "");
//Display the parsed string as received
SetCtrlVal(gMainWindow.statPanelTab, STAT_MAIN_STATUS,uiString);
break;
Before calling the EasyTab_AddPanels() funciton I do call
EasyTab_ConvertFromCanvas(gMainWindow.panel, MAINPANEL_CANVAS);
Please advice as to why the ResetTextBox() function does not work. Thanks!!
03-28-2012 12:01 AM - edited 03-28-2012 12:02 AM
Hello lvrat,
you are loading a panel whose constant name is STATTAB, so I would expect its controls are named STATTAB_SOMETHING; however, in ResetTexBox instruction you are manipulating STAT_MAIN_STATUS control, which evidently does not pertain to the correct panel. Apparently you have a panel named STAT_MAIN with a STATUS control in it, and that's why the compiler doesn't complain about that instruction, but the control is not on that panel and when you access a control with that reference id on the tab panel, it is not a textbox (it appears to be a string, though, so that SetCtrlVal returns no error).
Regarding GetPanelHandleFromTabPage, this instruction is aimed to get the panel handle associated with a page of native tab controls, not EasyTab, so it correctly returns an error since you are not using the built-in tab control in your application.
Just as a side note, you do not need to use ResetTextBox with an empty string and SetCtrlVal afterwards: a simple ResetTextBox with the proper string will replace the whole content of the control with the new text.
03-28-2012 02:12 AM
So to clear the string control the ResetTextBox function should not be used?
If SetCtrlVal is used then will it clear the string or does it append to the string value. I send a lot of status change to the string and would like to avoid the string to grow huge as the application executes.
I beleive that is the case with the textbox but not sure for string.
03-28-2012 02:26 AM
What is the error you are complaining on? I thought you actually had a textbox and you cannot clear it! Is your control actually a textbox or not?????
To make things clear:
03-28-2012 02:03 PM
Thanks that helped:)