About Dialog

Hello, All

I have 4 Dialogs: A, B, C, D. all modal dialogs

A owns B, B owns C, C owns D, and C and D are implement in VB code. A\B in VC.

And C was created in OnInitDialog() of B, so before C was destroyed, B can't been displayed.

And the same, D was created in Form_Load() of C, C will shown after D closed.

The problem is: while D was shown. If I navigate to another program, and switch back to this one, The dialog D will go behind A, so I can't do anything just like A was locked. I must use Tab+Alt to make Dialog D out.

may be the root cause is the parent window and owner window. my question is: is owner window was hidden, what's the behaviour of the current window.

Thanks

It is because all modal dialogues in an application have the "stay on top" flag set. However, only one form can actually be on top at a time.

What you should do is one of the following:

1. When you want to show a sub-dialogue, hide the current dialogue window. When the sub-dialogue returns, show the window.

2. Add an "application activate/receives focus" event handler, and go through the visible windows and stack them in the correct order (show them back to front).

Hope this helps.
Topic archived. No new replies allowed.