Modeless dialog shall not be modeless ! 
Author Message
 Modeless dialog shall not be modeless !

I have a modeless dialog derived from CPropertySheet. It is supposed to react on
service calls that are defined as public member functions. After creating the
dialog, control must be transferred to the caller. Thus, I cannot use DoModal to
start the dialog. However, I do not want other windows to get control as long as
the dialog is opened ! Can this be done ?

Right now, the dialog is created by Create and gets the parent window passed.
The dialog functions work alright, but it is still possible to click into other
windows of the application. This is not intended.

Any help appreciated
Regards, Eggert

-----------------------------------------------------
Answers please in this newsgroup!

-----------------------------------------------------



Sat, 12 Jan 2002 03:00:00 GMT  
 Modeless dialog shall not be modeless !

Hello,

I had nearly the same problem. The solution is very short. You must replace
in the Create function of Your dialog the last line.  VC++ generates
something like "return CDialog::Create(...);". You have to replace this code
by "return CDialog::DoModal();". Now You can also delete all variables You
do not need, that means which are generated with the Create function by
VC++.

HTH and have a nice day.

A. Fuss



Quote:
>I have a modeless dialog derived from CPropertySheet. It is supposed to
react on
>service calls that are defined as public member functions. After creating
the
>dialog, control must be transferred to the caller. Thus, I cannot use
DoModal to
>start the dialog. However, I do not want other windows to get control as
long as
>the dialog is opened ! Can this be done ?

>Right now, the dialog is created by Create and gets the parent window
passed.
>The dialog functions work alright, but it is still possible to click into
other
>windows of the application. This is not intended.

>Any help appreciated
>Regards, Eggert

>-----------------------------------------------------
>Answers please in this newsgroup!

>-----------------------------------------------------



Sat, 12 Jan 2002 03:00:00 GMT  
 Modeless dialog shall not be modeless !
I'm a little confused...

A modeless dialog that disables the user from interacting with any of the
other windows in the app.... sounds like a modal dialog to me!

Jeff
--
Jeffrey T. Muller
Genetic MicroSystems, Inc.

http://www.geneticmicro.com

Quote:
> I have a modeless dialog derived from CPropertySheet. It is supposed to
react on
> service calls that are defined as public member functions. After creating
the
> dialog, control must be transferred to the caller. Thus, I cannot use
DoModal to
> start the dialog. However, I do not want other windows to get control as
long as
> the dialog is opened ! Can this be done ?

> Right now, the dialog is created by Create and gets the parent window
passed.
> The dialog functions work alright, but it is still possible to click into
other
> windows of the application. This is not intended.

> Any help appreciated
> Regards, Eggert

> -----------------------------------------------------
> Answers please in this newsgroup!

> -----------------------------------------------------



Sat, 12 Jan 2002 03:00:00 GMT  
 Modeless dialog shall not be modeless !


Quote:
>I'm a little confused...

>A modeless dialog that disables the user from interacting with any of the
>other windows in the app.... sounds like a modal dialog to me!

A modal dialog is started by DoModal (); this function only returns after the
dialog has been closed. I need the dialog created and resume other tasks, which
run in the background. These tasks communicate with the dialog, and no other
user interface must be active until the task is done.

-----------------------------------------------------
Answers please in this newsgroup!

-----------------------------------------------------



Sat, 12 Jan 2002 03:00:00 GMT  
 Modeless dialog shall not be modeless !

Quote:

>Hello,

>I had nearly the same problem. The solution is very short. You must replace
>in the Create function of Your dialog the last line.  VC++ generates
>something like "return CDialog::Create(...);". You have to replace this code
>by "return CDialog::DoModal();". Now You can also delete all variables You
>do not need, that means which are generated with the Create function by
>VC++.

I am not sure I understand right. The Create is called inside of my constructor.
If I replace it by DoModal, the constructor will not be terminated until DoModal
is finished.

-----------------------------------------------------
Answers please in this newsgroup!

-----------------------------------------------------



Sat, 12 Jan 2002 03:00:00 GMT  
 Modeless dialog shall not be modeless !
Eggert,

What is "driving" these other tasks? Window messages or separate threads?

Jeff

--
Jeffrey T. Muller
Genetic MicroSystems, Inc.

http://www.geneticmicro.com

Quote:
> On Tue, 27 Jul 1999 10:30:24 -0400, "Jeff Muller"


Quote:

> >I'm a little confused...

> >A modeless dialog that disables the user from interacting with any of the
> >other windows in the app.... sounds like a modal dialog to me!

> A modal dialog is started by DoModal (); this function only returns after
the
> dialog has been closed. I need the dialog created and resume other tasks,
which
> run in the background. These tasks communicate with the dialog, and no
other
> user interface must be active until the task is done.

> -----------------------------------------------------
> Answers please in this newsgroup!

> -----------------------------------------------------



Sat, 12 Jan 2002 03:00:00 GMT  
 Modeless dialog shall not be modeless !
Do your other tasks just respond to user input from the dialog?  If so, you could
to use a modal dialog and send messages to the other tasks.  This is how the Apply
button is implemented on modal Property Sheets.
Quote:



> >I'm a little confused...

> >A modeless dialog that disables the user from interacting with any of the
> >other windows in the app.... sounds like a modal dialog to me!

> A modal dialog is started by DoModal (); this function only returns after the
> dialog has been closed. I need the dialog created and resume other tasks, which
> run in the background. These tasks communicate with the dialog, and no other
> user interface must be active until the task is done.

> -----------------------------------------------------
> Answers please in this newsgroup!

> -----------------------------------------------------



Sat, 12 Jan 2002 03:00:00 GMT  
 Modeless dialog shall not be modeless !


Quote:
>Eggert,

>What is "driving" these other tasks? Window messages or separate threads?

The task is a continuous process that updates parts of the dialog from time to
time (status messages etc.). It runs in the same thread that started the dialog.
The task in turn calls the RunModalLoop () method at certain intervals to let
the user interact with the dialog. All this works very well, except that the
dialog is not protected against user interaction with other windows.

-----------------------------------------------------
Answers please in this newsgroup!

-----------------------------------------------------



Sat, 12 Jan 2002 03:00:00 GMT  
 Modeless dialog shall not be modeless !


Fri, 19 Jun 1992 00:00:00 GMT  
 Modeless dialog shall not be modeless !

Quote:

>I have a modeless dialog derived from CPropertySheet. It is supposed to react on
>service calls that are defined as public member functions. After creating the
>dialog, control must be transferred to the caller. Thus, I cannot use DoModal to
>start the dialog. However, I do not want other windows to get control as long as
>the dialog is opened ! Can this be done ?

>Right now, the dialog is created by Create and gets the parent window passed.
>The dialog functions work alright, but it is still possible to click into other
>windows of the application. This is not intended.

The problem can be solved by using the CWnd::EnableWindow method on the parent
window. In the constructor:

        if (m_pParentWnd && m_pParentWnd->IsWindowEnabled())
                m_pParentWnd->EnableWindow(FALSE);

        Create (pParentWindow);

In the destructor:

        if (m_pParentWnd)
                m_pParentWnd->EnableWindow(TRUE);

Any comments ?

-----------------------------------------------------
Answers please in this newsgroup!

-----------------------------------------------------



Sun, 13 Jan 2002 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Q: tabbing not possible in modeless propertysheet / modeless dialog

2. Modeless property sheet in a modeless dialog box

3. Modeless dialog - what am I doing wrong?

4. modeless dialog box in my DLL not working

5. Modal vs. Modeless dialog and controls not showing

6. modeless dialog not showing

7. Why my modeless dialog can not display?

8. Modeless Dialog creation CRUSH in Release and Debug building but not with Debbuger mode

9. modeless dialog not working in CFormView (workspace enclosed)

10. modeless dialog box in my DLL not working

11. Modeless dialog button and listbox not appearing

12. Modeless Dialog not destroying properly

 

 
Powered by phpBB® Forum Software