LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Set attribute value

Solved!
Go to solution

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;

 

*************************************************
CLD
*************************************************
0 Kudos
Message 1 of 6
(3,535 Views)

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!!

*************************************************
CLD
*************************************************
0 Kudos
Message 2 of 6
(3,531 Views)

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.



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 6
(3,520 Views)

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.

  

*************************************************
CLD
*************************************************
0 Kudos
Message 4 of 6
(3,513 Views)
Solution
Accepted by topic author lvrat

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:

  • ResetTextBox applies only to TextBox controls; it clears the control and set the new text as its only content
  • SetCtrlVal on a string control replaces old content with the new text passed to it
  • SetCtrlVal on a TextBox control appends new text to the existing one


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 5 of 6
(3,510 Views)

Thanks that helped:)

*************************************************
CLD
*************************************************
0 Kudos
Message 6 of 6
(3,499 Views)