how about emwin WM_PAINT trigger mechanism?

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

    • how about emwin WM_PAINT trigger mechanism?

      New

      fresh man alway have much question. :)

      A window has been created.
      1. If the text of a text label of the window changed, wether a WM_PAINT message will be sent automatically?
      2. the message "WM_POST_PAINT", is "Send to a window after the last WM_PAINT message is sent",
      for user's code should be code in WM_POST_PAINT or WM_PRE_PAINT instead of WM_PAINT?

      My english is so good. <X

      thanks.
    • New

      case WM_PAINT:
      hMem00_Face = GUI_MEMDEV_Create(141, 15, 76, 76);
      GUI_MEMDEV_Select(hMem00_Face);
      GUI_SetColor(GUI_WHITE);
      GUI_SetPenSize(16);
      GUI_AA_DrawRoundedRect(149, 23, 209, 83, 30);
      GUI_MEMDEV_Select(0);
      break;

      The hMem00_Face is a global var, I count it will be broken 21 times if I set a break point at the "GUI_MEMDEV_Create" line.
      My code is compliled with no Optimzation Level 0.
      The code as it, the result is right. But I use the code below, the result is error, acted as no any effect.

      case WM_PAINT:
      if (WM_HMEM_NULL == hMem00_Face)
      {
      hMem00_Face = GUI_MEMDEV_Create(141, 15, 76, 76);
      }
      GUI_MEMDEV_Select(hMem00_Face);
      GUI_SetColor(GUI_WHITE);
      GUI_SetPenSize(16);
      GUI_AA_DrawRoundedRect(149, 23, 209, 83, 30);
      GUI_MEMDEV_Select(0);
      break;

      The hMem00_Face is init as WM_HMEM_NULL.

      So if I use the fisrt codes, is there a memory leak happen? And how I delete the memory device?