Modeless dialog called from Modal dialog woes. 
Author Message
 Modeless dialog called from Modal dialog woes.

I have a Modal dialog with another dialog as a member variable.  On the
modeless dialog, I have two text objects that are attached to variables that
update as expected during the "stuff..." section.  I have two other
IDC_STATIC text items and a cancel button.. but these items aren't
displayed.. what is wrong?  If I comment out the SW_HIDE and delete lines,
the modeless dialog appears as intended after the modal is dismissed... at
this point, however, it's too late and the program eventaully crashes.

In the OnInitDialog of the modal dialog I have the following skeleton code:

BOOL CDlgShtList::OnInitDialog()
{
 CDialog::OnInitDialog();
 dlgGenIdx = new CDlgGenIdx();
 dlgGenIdx->Create(IDD_DLG_GI);
 dlgGenIdx->ShowWindow(SW_SHOW);

 // TODO: Add extra initialization here
// stuff....

// if I comment out these two lines, the dialog
// appears with the static text and cancel button...
//  but it's too late by now!
 dlgGenIdx->ShowWindow(SW_HIDE);
 delete dlgGenIdx;

 return TRUE;  // return TRUE unless you set the focus to a control
               // EXCEPTION: OCX Property Pages should return FALSE

Quote:
}



Sun, 25 Sep 2005 16:19:51 GMT  
 Modeless dialog called from Modal dialog woes.
A call to
 dlgGenIdx->RedrawWindow();
after the SW_SHOW solves the problem... can someone explain what is
happening here - seems like the resource swap(?) was late or something?

Thanks,
MS


Quote:
> I have a Modal dialog with another dialog as a member variable.  On the
> modeless dialog, I have two text objects that are attached to variables
that
> update as expected during the "stuff..." section.  I have two other
> IDC_STATIC text items and a cancel button.. but these items aren't
> displayed.. what is wrong?  If I comment out the SW_HIDE and delete lines,
> the modeless dialog appears as intended after the modal is dismissed... at
> this point, however, it's too late and the program eventaully crashes.

> In the OnInitDialog of the modal dialog I have the following skeleton
code:

> BOOL CDlgShtList::OnInitDialog()
> {
>  CDialog::OnInitDialog();
>  dlgGenIdx = new CDlgGenIdx();
>  dlgGenIdx->Create(IDD_DLG_GI);
>  dlgGenIdx->ShowWindow(SW_SHOW);

>  // TODO: Add extra initialization here
> // stuff....

> // if I comment out these two lines, the dialog
> // appears with the static text and cancel button...
> //  but it's too late by now!
>  dlgGenIdx->ShowWindow(SW_HIDE);
>  delete dlgGenIdx;

>  return TRUE;  // return TRUE unless you set the focus to a control
>                // EXCEPTION: OCX Property Pages should return FALSE
> }



Sun, 25 Sep 2005 17:15:14 GMT  
 Modeless dialog called from Modal dialog woes.
In short, don't do it. It has been a long time since I had a good understanding
of what and how breaks when you try to do it.
Basically, modal windows are designed to be the topmost window in an application.
Because of it's private message loop, I think it is still (from W31) not
designed to dispatch messages to other windows ( POPUP perhaps being the
criteria ) both the keyboard interface and repainting are affected.
I consider it a bad program if I can't tab among it's windows with the keyboard,
which I currently have a problem with in my app (between main window and a tool
dialog )but it was not the most burning issue to look into.

Cheers, Sam

Quote:

> I have a Modal dialog with another dialog as a member variable.  On the
> modeless dialog, I have two text objects that are attached to variables that
> update as expected during the "stuff..." section.  I have two other
> IDC_STATIC text items and a cancel button.. but these items aren't
> displayed.. what is wrong?  If I comment out the SW_HIDE and delete lines,
> the modeless dialog appears as intended after the modal is dismissed... at
> this point, however, it's too late and the program eventaully crashes.

> In the OnInitDialog of the modal dialog I have the following skeleton code:

> BOOL CDlgShtList::OnInitDialog()
> {
>  CDialog::OnInitDialog();
>  dlgGenIdx = new CDlgGenIdx();
>  dlgGenIdx->Create(IDD_DLG_GI);
>  dlgGenIdx->ShowWindow(SW_SHOW);

>  // TODO: Add extra initialization here
> // stuff....

> // if I comment out these two lines, the dialog
> // appears with the static text and cancel button...
> //  but it's too late by now!
>  dlgGenIdx->ShowWindow(SW_HIDE);
>  delete dlgGenIdx;

>  return TRUE;  // return TRUE unless you set the focus to a control
>                // EXCEPTION: OCX Property Pages should return FALSE
> }



Wed, 28 Sep 2005 10:01:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Modal dialog called with DoModal() changes to modeless

2. Modeless Dialog box in a Modal Dialog Application...

3. Modeless dialog box together with modal dialog box

4. Modeless Dialog from Modal Dialog question ?

5. Post message from modal dialog to modeless dialog box....urgent!!!!!!!!!!!!!!1

6. Modeless dialog on top of Modal dialog

7. Modeless Child Dialog of Modal Dialog

8. In modal dialog read data of calling dialog

9. modal dialogs on top of modal dialogs...

10. Showing a modal dialog in a modal dialog application

11. modal dialog spawning a modal dialog

12. Modal dialog over a modal dialog ( How to...?)

 

 
Powered by phpBB® Forum Software