Hi ,
I have a main window which has a Text Box [hText1] and this text box has two other child text boxes [hText_c1] and [hText_c2] . Both the child text boxes display three digit numbers which keeps on changing from 0 to 999 . So I added the below code in my Freertos task as below :
static void digit_rotate(void *pvParamaters)
{
int i;
for(;;){
for(i= 000;i<999;i++){
GUI_Exec();
itoa(i,str,10);
WM_Invalidate(hText_c1);
vTaskDelay(TIME_DELAY_SLEEP);
}
}
}
I created the text boxes using the GUI builder and the text box creation is added under WM_INIT_DIALOG as below
hText1= WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
TEXT_SetBkColor(hText1,GUI_OFFWHITE);
TEXT_SetText(hText1,"");
hText_c1= WM_GetDialogItem(pMsg->hWin, ID_TEXT_5);
TEXT_SetFont(hText_c1, &GUI_FontTimesNewRoman250);
TEXT_SetTextAlign(hText_c1, GUI_TA_HCENTER | GUI_TA_VCENTER);
WM_SetCallback(hText_c1,_cbchangevalue); // Call back function for the first child window whether WM_PAINT message is proccessed.
hText_c2= WM_GetDialogItem(pMsg->hWin, ID_TEXT_6);
TEXT_SetFont(hText_c2, &GUI_FontTimesNewRoman250);
TEXT_SetTextAlign(hText_c2, GUI_TA_HCENTER | GUI_TA_VCENTER);
The callback function of the first child box to change the text box value is
static void _cbchangevalue(WM_MESSAGE * pMsg)
{
int res;
switch (pMsg->MsgId){
case WM_PAINT:
res = TEXT_SetText(hText_c1, str);
PRINTF("\n Set text is %d \n",res);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
I made sure that the control is moving to the _cbchangevalue and I am getting the TEXT_SetText return value as success and failure alternatively and the first child box appears to be blank all the time.
It will be helpful if someone explains what is actually happening here. What am I missing in my code?
I have a main window which has a Text Box [hText1] and this text box has two other child text boxes [hText_c1] and [hText_c2] . Both the child text boxes display three digit numbers which keeps on changing from 0 to 999 . So I added the below code in my Freertos task as below :
static void digit_rotate(void *pvParamaters)
{
int i;
for(;;){
for(i= 000;i<999;i++){
GUI_Exec();
itoa(i,str,10);
WM_Invalidate(hText_c1);
vTaskDelay(TIME_DELAY_SLEEP);
}
}
}
I created the text boxes using the GUI builder and the text box creation is added under WM_INIT_DIALOG as below
hText1= WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
TEXT_SetBkColor(hText1,GUI_OFFWHITE);
TEXT_SetText(hText1,"");
hText_c1= WM_GetDialogItem(pMsg->hWin, ID_TEXT_5);
TEXT_SetFont(hText_c1, &GUI_FontTimesNewRoman250);
TEXT_SetTextAlign(hText_c1, GUI_TA_HCENTER | GUI_TA_VCENTER);
WM_SetCallback(hText_c1,_cbchangevalue); // Call back function for the first child window whether WM_PAINT message is proccessed.
hText_c2= WM_GetDialogItem(pMsg->hWin, ID_TEXT_6);
TEXT_SetFont(hText_c2, &GUI_FontTimesNewRoman250);
TEXT_SetTextAlign(hText_c2, GUI_TA_HCENTER | GUI_TA_VCENTER);
The callback function of the first child box to change the text box value is
static void _cbchangevalue(WM_MESSAGE * pMsg)
{
int res;
switch (pMsg->MsgId){
case WM_PAINT:
res = TEXT_SetText(hText_c1, str);
PRINTF("\n Set text is %d \n",res);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
I made sure that the control is moving to the _cbchangevalue and I am getting the TEXT_SetText return value as success and failure alternatively and the first child box appears to be blank all the time.
It will be helpful if someone explains what is actually happening here. What am I missing in my code?