Embeded dialog problem
Navid Ghiami -- navid@direct.ca
Wednesday, April 24, 1996
Env: VC4.1 NT4.0(build 1234)
I have a dialog based application that has dialogs inside dialogs.
I use DoModal to bring them up. My problem is that when the third
dialog exists the first dialog becomes active.
Here is what happens:
1. Application starts : Dialog A
2. in A press a button to call: B.DoModal();
3. in B press a button to call: C.DoModal();
4. in C press OK to exit the dialog.
now Dialog A becomes active, which is not what i want. I want A to wait until
B also exists.
How can I have dialogs inside dialogs where the control follows the hierarchy,
keeping in mind that in the above example B and C could be called from any
other dialog?
any suggestions welcome,
navid.
Geoffrey Nicholls -- geoff@gazelle.com
Thursday, April 25, 1996
[Mini-digest: 4 responses]
>1. Application starts : Dialog A
>2. in A press a button to call: B.DoModal();
>3. in B press a button to call: C.DoModal();
>4. in C press OK to exit the dialog.
>now Dialog A becomes active, which is not what i want. I want A to wait until
>B also exists.
Make sure that the parent window of each dialog is correct. If the parent of
C is B, then windows is supposed to put the focus back there when C completes.
Geoffrey Nicholls
-----From: Eric Kenslow
At 04:49 AM 4/24/96 -0700, you wrote:
>Env: VC4.1 NT4.0(build 1234)
>
Sounds like dialog C's parent is being set to your main application
window. Try explicitly setting dialog B as C's parent.
Sorry, I don't have a compiler available to try this with, so I don't know
if it will work.
/* Eric Kenslow
* Student of Software Engineering, Oregon Institute of Technology
* kenslowe@mail.oit.osshe.edu
* http://www.oit.osshe.edu/~kenslowe (Senior Project & Resume Online)
*/
-----From: kolmstead@peggles.com
It seems like the parent (or owner) of your dialogs are not being set
correctly. CWnd has a SetParent and a SetOwner method. You should
try setting that during initialization.
Ideally this should somehow be set before DoModal. CDialog::Create
will optionally take a CWND, so that's a good place to do it, as
well.
There's a method called PreModal that is called by DoModal that
returns the window handle that will be used as the parent.
Unfortunately it's not virtual.
thanks,
Kraig Olmstead
-----From: Brad Wilson/Crucial Software
Did you try:
B.DoModal( this ); // where this is a pointer to A
C.DoModal( this ); // where this is a pointer to B
Good luck!
Brad
| Вернуться в корень Архива
|