Friday, February 23rd 2018, 7:38pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.



Date of registration: Feb 18th 2016

Posts: 21


Thursday, November 16th 2017, 5:32pm

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

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 496


Wednesday, November 22nd 2017, 9:19am

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().