Draw into child windows from parent paint function

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

  • Draw into child windows from parent paint function

    I have a parent window called P that has child window called C.
    The WM_PAINT handler for P has to draw some graphical element into P and also into C. I cannot select C windows into WM_PAINT handler, so how can I do it?

    best regards
    Max
  • Hello Max,

    Each window should take care about its own content. So, window P should draw only into itself and window C should draw only into window C. If you want that window C changes its content you have to tell the cild window to do so. You can use WM_Invalidate() to mark the the child window as invalid and it gets redrawn the next time GUI_Exec() or GUI_Delay() gets called.

    But be aware, do not call WM_Invalidate() from within WM_PAINT this might lead to at least too many redraws or in the worst case to an endless loop.

    I guess there is a specific event when the window C should be drawn. React on this event and call WM_Invalidate().

    Regards
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.