Paint drawing issues

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

    • Paint drawing issues

      Hello,

      I have used 2-3 gif's on my dialog window and am using using image_SetGif function and they are working fine. I have other Text widgets and some drawing in Paint too.

      The following widgets below have to be updated and some drawing in my dialog window,

      1) Image widget on Top Left corner of window on event in 25msec scheduler.
      2) 3 GIF's using 3 image widgets placed at the left of the window. (at one time all the GIF's are animating simultaneously) animation initiated in 25msec scheduler on events.
      3) Arc's and GUI_MEMDEV_WriteAt at the center of the window have to be updated on variable change. (called WM_InvalidateArea only if change in 25msec scheduler to update)
      4) Text widget placed at the top right updated only on event. checked in 25msec scheduler.
      5) Text widget at the bottom corner right updated every minute. checked in 25msec scheduler.

      While loading the dialog window the area drawn in point 3 above gets cleared. It is not repetitive and the behavior is random. Also whenever any text widget is updated in 25msec loop the area drawn in point 3 gets cleared.

      The point no 3 is handled in WM_PAINT as below,

      case WM_PAINT:

      GUI_SetBkColor();
      GUI_Clear();

      // Handle point 3 mentioned above
      if(paramChange){
      paramChange = 0;
      GUI_drawArc1();
      GUI_drawArc2();
      GUI_drawArc3();
      GUI_drawArc4();

      GUI_MEMDEV_WriteAt();

      }

      break;

      Observations

      1) using Image_SetGif continuously calls WM_PAINT.
      2) if I remove the IF condition above it works without any issue but I do not want to draw the other area every time. It also decreases the performance if drawn every time.
      3) If I keep the IF condition then the area with the dial and memdev write area gets displayed once on dialog load and then gets cleared.
      4) if the dial area is not cleared on window load then sometimes whenever a TEXT_SetText is called then it gets cleared. TEXT widget is on a totally different area on the window and it does not coincide with the dial area.

      So am not sure how to handle this behavior. How can I make sure to draw the Arcs and GUI_MEMDEV_WriteAt only when required in WM_PAINT.
      Please let me know what can be done to resolve this.

      Thanks
      Regards,
      Anuj
    • Hello,

      It seems the WM_PAINT invalidates a larger area in above case where the arc gets cleared.

      As GIF widgets are at the left of the window and date and time text widget is at the bottom right of the window if both have to be updated then emwin updates the whole rectangle. Due to this the center area where ARC is present gets cleared. (As per "Invalidation" section in Emwin Manual)

      I used WM_ValidateWindow to specify emwin do not update the ARC area, due to this if earlier the issue was coming in 2-3 minutes then after calling WM_ValidateWindow the issue arises after approx an hour.

      Is there any way to avoid the above default emwin behavior?

      Thanks
      Regards
      Anuj