Decimal separators in Emwin

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • GUI_SetDecChar(',') will work only if I use api like GUI_DispFloat(). Is that correct?


      I am displaying values using API GUI_DispStringInRect(), Since I need to show the value at particular position on custom button.
      Please check the Code is shared below:

      void YButnCallBack(WM_MESSAGE *pMsg)
      {
      GUI_RECT rect0 = { 10,10,255,70 };
      GUI_RECT rect1 = { 256,10,330,70 };
      GUI_RECT rect2 = { 331,10, 380,70 };

      char strY[5];
      snprintf(strY, sizeof(strY), "%.1f", Ysize); // (YSize is float variable that will keep changing)
      switch (pMsg->MsgId)
      {
      case WM_PAINT:
      if (BUTTON_IsPressed(pMsg->hWin))
      {
      GUI_SetBkColor(AZURE_BLUE);
      GUI_Clear();
      GUI_SetFont(FONT_16);
      GUI_SetColor(GUI_BLACK);
      GUI_DispStringInRect("Y:", &rect0, GUI_TA_LEFT | GUI_TA_BOTTOM);
      }
      else
      {
      GUI_SetBkColor(GUI_BLACK);
      GUI_Clear();
      GUI_SetFont(FONT_16);
      GUI_SetColor(AZURE_BLUE);
      GUI_DispStringInRect("Y:", &rect0, GUI_TA_LEFT | GUI_TA_BOTTOM);
      GUI_SetColor(LIGHT_GREY);
      }
      GUI_DispStringInRect("cm", &rect2, GUI_TA_RIGHT | GUI_TA_BOTTOM);

      GUI_SetFont(FONT_25);
      GUI_DispStringInRect(strY, &rect1, GUI_TA_RIGHT | GUI_TA_BOTTOM);
      break;
      default:
      BUTTON_Callback(pMsg);
      break;
      }
      }