Saturday, April 21st 2018, 1:30pm UTC+2

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.

Amit

Beginner

Date of registration: Oct 28th 2015

Posts: 71

1

Friday, December 15th 2017, 6:10am

Need help in understanding behavious or multiple child windows

Hi,

I have 3 child windows located at (15,15) with size (320,240). All 3 windows belong to same parent and created with WM_CreateWindowAsChild().
Each window has an OK button , if touched, it closes that respective window with WM_DeleteWindow();
All child window's callback routine is having WM_MakeModal(pMsg->hWin) in their WM_PREPAINT case.

Problem:
When 3 windows are drawn on the top of each other, I press on OK button on Topmost window which closes that window. Now Im not able to press on OK button of middle window. The window doesnt receive any messages.
Just for checking i shifted bottom window little so that i could press on OK button. So i observed that, bottomost window was active and i was able to press on OK button. After pressing that window got closed and then only middle window got active and then i was able to press on that window.
Why it happened ?
I was expecting that when i press on OK button of topmost window, it should get closed. Then i should be able to press on OK button of middle window. After press it should get deleted. And then the bottommost window should get active & and on pressing OK button of it, it should get deleted.
But this is not happening.

Please guide me here in understanding the behaviour.

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 561

2

Monday, December 18th 2017, 11:58am

Hi,

You shouldn't set the modal attribute when within WM_PRE_PAINT. Only one window can be modal and this way you won't really know which window will be the modal one. This would explain why you experience a different behavior as expected.

Regards
Sven

Amit

Beginner

Date of registration: Oct 28th 2015

Posts: 71

3

Monday, December 18th 2017, 12:28pm

[Solved] Need help in understanding behavious or multiple child windows

Dear Sven,

Thank you so much for your kind reply and guidance. So It looks like WM_PRE_PAINT gets called everytime when redrawing is needed and that's what causing this behaviour. I'll avoid calling it from there and check the behaviour.
Thanks :)

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 561

4

Monday, December 18th 2017, 1:09pm

Hi,

Quoted

So It looks like WM_PRE_PAINT gets called everytime when redrawing is needed and that's what causing this behaviour.
Yes, it is always send to a window before the WM_PAINT message.

Regards
Sven