Hi, I have a question, I used the GUI Builder to build a small GUI for my Nucleo. The GUI is working fine and i want to plot some variables in the GUI. I use a TEXT_Widget and a special callback function to change the Widget for my purpose.
I use the following function _cbText, but this widget stays always frozen. I searched a bit in the manual and I found only a very bad workaround, I use this code
to trigger the refresh of the text widget when an event occurs .
Could someone help me to fix it and to have real-time data of the variables ?
Display All
I use the following function _cbText, but this widget stays always frozen. I searched a bit in the manual and I found only a very bad workaround, I use this code
to trigger the refresh of the text widget when an event occurs .
Could someone help me to fix it and to have real-time data of the variables ?
C Source Code
- static void _cbText(WM_MESSAGE * pMsg) {
- GUI_RECT Rect;
- GUI_COLOR ColorFrame;
- GUI_COLOR Color;
- GUI_COLOR ColorText;
- GUI_CONST_STORAGE GUI_FONT * pFont23;
- GUI_CONST_STORAGE GUI_FONT * pFont32;
- switch (pMsg->MsgId) {
- case WM_PAINT:
- GUI_Clear();
- Color = DARK_BLUE;
- ColorText = GUI_WHITE;
- ColorFrame = GUI_WHITE;
- pFont23 = pFont23p;
- pFont32 = pFont32p;
- //
- // Draw thin frame around the button
- //
- WM_GetClientRectEx(pMsg->hWin, &Rect);
- GUI_SetColor(ColorFrame);
- GUI_FillRectEx(&Rect);
- GUI_SetColor(Color);
- //
- // Resize drawing rect
- //
- Rect.x0 += 1;
- Rect.x1 -= 1;
- Rect.y1 -= 1;
- //
- // Draw rest of the button
- //
- GUI_AA_FillRoundedRectEx(&Rect, 3);
- //
- // Draw Text
- //
- GUI_SetFont(&GUI_Font16_ASCII);
- GUI_SetColor(ColorText);
- GUI_SetTextAlign(GUI_TA_LEFT | GUI_TA_VCENTER);
- GUI_GotoXY(Rect.x0, Rect.y0+20);
- GUI_DispString("On/Off");
- GUI_GotoXY(Rect.x0+80, Rect.y0+20);
- GUI_DispDecSpace(stateOfProgram, 1);
- GUI_GotoXY(Rect.x0, Rect.y0+40);
- GUI_DispString("Man/Auto");
- GUI_GotoXY(Rect.x0+80, Rect.y0+40);
- GUI_DispDecSpace(selectProgram, 2);
- GUI_GotoXY(Rect.x0, Rect.y0+60);
- GUI_DispString("PID_H");
- GUI_GotoXY(Rect.x0+80, Rect.y0+60);
- GUI_DispDecSpace(inputValue_Htng, 2);
- GUI_GotoXY(Rect.x0, Rect.y0+80);
- GUI_DispString("PID_C");
- GUI_GotoXY(Rect.x0+80, Rect.y0+80);
- GUI_DispDecSpace(inputValue_Coolg, 2);
- GUI_GotoXY(Rect.x0, Rect.y0+100);
- GUI_DispString("Temp.");
- GUI_GotoXY(Rect.x0+80, Rect.y0+100);
- GUI_DispDecSpace(Temperature, 2);
- GUI_GotoXY(Rect.x0, Rect.y0+120);
- GUI_DispString("Time");
- GUI_GotoXY(Rect.x0+80, Rect.y0+120);
- GUI_DispDecSpace(SOLLtemperature, 2);
- //
- // Display temperature with a bigger font
- //
- int Index = ((SOLLtemperature - MIN_TEMPERATURE) * (GUI_COUNTOF(_aGradient) - 1)) / (MAX_TEMPERATURE - MIN_TEMPERATURE);
- Color = _aGradient[Index];
- // GUI_SetColor(Color);
- //GUI_SetBkColor(Color);
- //GUI_Clear();
- //GUI_SetColor(GUI_WHITE);
- /*GUI_SetFont(pFont32);
- GUI_SetTextAlign(GUI_TA_RIGHT | GUI_TA_VCENTER);
- GUI_GotoXY(Rect.x1 - 20, Rect.y1 / 2);
- GUI_DispDecSpace(SOLLtemperature, 2);
- GUI_DispString("�C");*/
- break;
- default:
- TEXT_Callback(pMsg); // The original callback
- break;
- }
- }