[SOLVED] WM_PAINT being called every time a button is touched or an update to text widget

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

    • [SOLVED] WM_PAINT being called every time a button is touched or an update to text widget


      I have observed something weird recently. I hope some one here can help me get rid of this problem.
      I have a created a window with Button, drawing, Text Widget.
      1. Every time a button is pressed, I am changing numbers on a text widget.
      2. I have an additional text widget that has been functioned to change value when a certain hardware malfunction happens.

      Both these times I see that any update to a certain text widget causes the whole screen to draw.

      Has anyone come across this issue?
      I really appreciate any help with this regard.

      Thanks and regards,
    • Hi,

      when a child window is redrawn, the parent window is also redrawn. But generally only the necessary area is redrawn. Though, drawing operations, e.g. a circle, cannot be partially redrawn, they can only be drawn completely. You can check the area by looking at the GUI_RECT pointer in pMsg->Data.p sent with every WM_PAINT message.

      For example, if there is a bitmap in the background parent window, only the area affected from redrawing the button is redrawn. This is necessary because colors have to be mixed again with the background colors when a transparent window is redrawn. The BUTTON widget per default has transparent edges.

      If you want to minimize this, you have to make sure that all widgets do not have the WM_CF_HASTRANS flag set. Per default, it is set to the TEXT widget automatically, as well as the BUTTON. You can clear the flag using WM_ClrHasTrans().

      Best regards,

    • Hi Florian,

      Really appreciate you trying to help. I will try to implement it.

      Meanwhile, I forgot to put up another question up there:
      1. So I am drawing something in the background using WM_PAINT of _cbdialog(). But I only want it drawn once when the window is being called for the first time. Is there a possibility to not allow it to draw every time there is a change on the window?

      I understand that clearing the flag WM_ClrHasTrans() for widgets. How do you suggest I do it for WM_PAINT?

      Thank you so much.
      Best regards,