Embedded dialog problem
Greg Brewer - Ext. 4623 -- gbrewer@ontime.com
Friday, April 26, 1996
In MFC 4.1 DoModal doesn't really create a modal dialog, it creates a
modeless dialog and emulates a modal dialog's behavior. (note in VC++ 1.5
this in NOT what happens) It disables the dialog's parent window before
creating the dialog an re-enables it after (dlgcore.cpp, CDialog::DoModal).
If no parent window is specified the parent window defaults to the
application's main window.
So in your example Dialog C's parent should be Dialog B.
Hope this helps.
Gregory A. Brewer
Software Engineer
Campbell Services, Inc
(810) 559-5955 ext. 4623
GBREWER@ONTIME.COM
Home Page: http://www.ontime.com
-------------
Original Text
>From NAVID@SMTP (Navid Ghiami) {navid@direct.ca}, on 4/24/96 6:49 AM:
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.
Mats Mеnhav -- manhav@connectum.skurup.se
Sunday, April 28, 1996
-- [ From: Mats Manhav * EMC.Ver #2.5.02 ] --
If the modal dialog box is only a fake modal dialog.
Is it possible to make a modeless dialog looking exactly
the same as the modal one. I would like to have my property
sheets as modeless, but I do want the OK Cancel and Help
buttons in there.
Mats
-------- REPLY, Original message follows --------
> Date: Friday, 26-Apr-96 11:29 AM
>
> From: Greg Brewer - Ext. 4623 \ Internet: (gbrewer@ontime.com)
> To: MFCList \ Internet: (mfc-l@netcom.com)
>
> Subject: re: Embedded dialog problem
>
> In MFC 4.1 DoModal doesn't really create a modal dialog, it creates a
> modeless dialog and emulates a modal dialog's behavior. (note in VC++ 1.5
> this in NOT what happens) It disables the dialog's parent window before
> creating the dialog an re-enables it after (dlgcore.cpp, CDialog::DoModal)
.
> If no parent window is specified the parent window defaults to the
> application's main window.
>
> So in your example Dialog C's parent should be Dialog B.
>
> Hope this helps.
>
> Gregory A. Brewer
> Software Engineer
> Campbell Services, Inc
> (810) 559-5955 ext. 4623
> GBREWER@ONTIME.COM
> Home Page: http://www.ontime.com
> -------------
> Original Text
> >From NAVID@SMTP (Navid Ghiami) {navid@direct.ca}, on 4/24/96 6:49 AM:
> 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.
>
-------- REPLY, End of original message --------
--
==========================================================================
Mats Mеnhav (Mats Manhav for 7-bit people)
email:manhav@connectum.skurup.se WWW: http://connectum.skurup.se/~manhav
FAX: (int) 46 (0) 414 243 05 Phone: (int) 46 (0) 414 243 05
==========================================================================
David W. Gillett -- DGILLETT@expertedge.com
Monday, April 29, 1996
> If the modal dialog box is only a fake modal dialog. Is it possible
> to make a modeless dialog looking exactly the same as the modal
> one. I would like to have my property sheets as modeless, but I do
> want the OK Cancel and Help buttons in there.
CPropertySheet has a data member (m_psh?) which contains various
information passed on to the COMCTL32.DLL PropertySheet()
implementation, and one of those is a flag indicating if the property
sheet is to be modeless. It's possible that if you derive your own
sheet class, you might be able to override this in OnCreate() (before
the base-class call, I'd expect) and so force creation of a sheet
with modal appearance even though it won't be operated modally.
[If PropertySheet() really does a modal dialog when the "modeless"
flag is not set, this isn't going to work. The other alternative is
to build your own modeless dialog with the necessary buttons, and
with a modeless CPropertySheet-derivative as a child. This is a bit
more grunt-work, but not particularly difficult.]
Dave
| Вернуться в корень Архива
|