#CDialogDirector 1.1.3
4 messages in this thread
I am converting a project developed under TCL 1.1.2 to TCL 1.1.3. A change
which has been made to CDialogDirector is causing me some confusion.
—
The problem is that CDialogDirector::Close() now refuses to close modal
dialogs, as follows:
…
if (itsWindow->IsModal())
{
dismissCmd = cmdClose;
return TRUE; // CDirector::Close() never gets called!
}
else
return inherited::Close(fQuitting); // calls CDirector::Close()
…
—
To implement a simple modal dialog box, I used to do this under TCL 1.1.2:
…
myDialogDirector->itsWindow->SetModal(TRUE);
myDialogDirector->BeginDialog();
myDialogDirector->DoModalDialog(cmdOK);
myDialogDirector->Close(FALSE); // calls CDialogDirector::Close()
…
—
According to the documentation for TCL 1.1.3, this should be rewritten as:
…
myDialogDirector->BeginModalDialog();
myDialogDirector->DoModalDialog(cmdOK);
myDialogDirector->Close(FALSE); // calls CDialogDirector::Close()
…
—
The above technique leaves a dismissed dialog hanging open on the screen, so I
now have to do this under TCL 1.1.3:
…
myDialogDirector->BeginModalDialog();
myDialogDirector->DoModalDialog(cmdOK);
myDialogDirector->CDirector::Close(FALSE); // bypasses CDialogDirector::Close()
…
—
Bypassing CDialogDirector::Close() fixes the problem, in a clumsy kind of way,
but I am concerned about compatibility with future releases of TCL. What is the
recommended method for closing a modal dialog implemented with CDialogDirector?
Thanks in advance,
David Jokinen
Ground Zero Software
David,
I have always done the following:
theDial = new CMyDialog;
theDial->IMyDialog( );
theDial->BeginDialog();
theDial->DoModalDialog(cmdOK);
ForgetObject(theDial);
worked in 1.1.2 and it works now. The dialog is closed with the ForgetObject()
call.
jud spencer
Jud:
Your technique seems to bypass CDirector::Close() as well. It seems to do some
checking for multiple concurrent close requests and exceptions that occur
during the close. I wonder if it's prudent to skip two whole levels of the TCL,
especially when you consider future updates. Until I hear from Symantec, I'll
stick with just skipping over CDialogDirector::Close().
Because the problem only occurs with MODAL dialogs, it seems like another
technique that should work is:
…
myDialogDirector->BeginModalDialog();
myDialogDirector->DoModalDialog(cmdOK);
myDialogDirector->itsWindow->SetModal(FALSE);
myDialogDirector->Close(FALSE);
…
David
David,
RE: " I wonder if it's prudent to skip two whole levels of the TCL, especially
when you consider future updates."
I am not too concerned about future updates. From here on out it might as well
be the JudCL.
jud