Dialog-frame and persistent

Posted by bart.syryn on 04-Nov-2008 13:50

Hi Folks,

I will try to explain what my problem is :

I have a classic window (a.w). There, I start a new window (b.w). In b.w I run a suppressed window (c.w) with some widgets on. So far so good. But now I want to change b.w to a dialog window. The problem is that c.w is now run in a.w and not in b.w. Is there a solution for this ?

I want to change b.w to a dialog because the user may not close a.w before b.w is closed. I think the only solution is that b.w is a dialog-window ?

code example :

a.w :

run b.w

in b.w, run c.w persistent set hWinHandle. -> when b.w is a normal window, everything is ok, but when b.w is a dialog, c.w is visible in a.w

Kind regards

All Replies

Posted by kevin_saunders on 05-Nov-2008 02:47

A dialog cannot parent a window, which is why c.w is suppressed and parented by a.w.

A potential solution is to get rid of c.w and use it's frame as a hidden frame on b.w. Then, when you need c.w, hide the default frame in b.w and show the c.w frame. The downside is it is messy and maintenance is a potential nightmare.

Posted by Håvard Danielsen on 05-Nov-2008 07:54

> I want to change b.w to a dialog because the user may not close a.w before b.w is closed.

You should consider doing this check on close of a.w. A common approach is to use a yes-no-cancel question; Yes - to save the changes in b.w(or c.w), No - to ignore and cancel these changes and Cancel - don't close any window.

Posted by bart.syryn on 06-Nov-2008 01:51

Ok, I can assume it's not possible and that c.w is run in a.w. At that point, it seems that b.w is a normal window en not a dialog window. But how can I prevent the user from closing a.w when b.w is run ?

Posted by kevin_saunders on 06-Nov-2008 02:37

If b.w is run persistent, then when the user attempts to close a.w, check for the existence of b.w using the handle and prevent the event after warning the user.

If b.w is not persistent, then you should be able to check for the existence of child windows by walking the widget tree and checking the procedure names.

This thread is closed