Monday, December 11th 2017, 6:44am UTC+1

You are not logged in.

  • Login
  • Register

mastupristi

Beginner

Date of registration: Feb 18th 2016

Posts: 13

1

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
Max

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 438

2

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

Regards
Sven