
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
> }