Need help in understanding behavious or multiple child windows

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

  • 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.
  • 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
    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.
  • [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 :)
  • Hi,

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