Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » ProfUISMsgBox makes parent modal dialog non-modal Collapse All
Subject Author Date
Jon Ort Dec 4, 2014 - 9:49 AM

I believe I have uncovered what appears to be a fairly serious defect in Prof-UIS.
I discovered it in version 3.00 and have verified that it exists in 3.01 and at least as far back as 2.93.

If a message box is displayed in a modal dialog box OnOK method that causes returning from the method without closing the dialog (not calling base OnOK) the parent dialog is no longer modal after closing the message box.


I have recreated the issue using the Skinable sample program provided with Prof-UIS.
In ...\Prof-UIS\Src\ExtColorDlg.cpp modify void CExtColorDlg::OnOK() to add the following 2 lines right after the ASSERT_VALID macro.
    if (ProfUISMsgBox(NULL, "The file already exists. Overwrite?", "Confirm choice", MB_YESNO) == IDNO)
        return;

The method should look thus:
void CExtColorDlg::OnOK()
{
    ASSERT_VALID( this );
    if (ProfUISMsgBox(NULL, "The file already exists. Overwrite?", "Confirm choice", MB_YESNO) == IDNO)
        return;

    _ColorModelSave();
    __BASEOF_CExtColorDlg__::OnOK();
}

Recompile the libraries and Skinable and run it.
We use the following configurations in our system so I used them here as well.
    Static ANSI Debug RDE with MFC DLL
    Static ANSI Debug with MFC DLL

Under the Modal Dialogs panel click on "Color selection dialog..."
The Select color ... dialog is displayed. Note that it is modal - you can’t click anywhere else.
Click OK.
The message box is displayed.
Click No.
The message box closes and the Select color dialog remains, but it no longer modal.
You can open another Select color dialog and/or do anything else in the Skinable application.

Now, comment out the message box call but leave the return statement.
Recompile the libraries and Skinable and run it.
Under the Modal Dialogs panel click on "Color selection dialog..."
The Select color ... dialog is displayed. Note that it is modal - you can’t click anywhere else.
Click OK.
No message box is displayed but the Select color dialog remains - and is still modal. You must close it with Cancel to continue working with Skinable.


It appears to be legal to return from OnOK requiring the user to fix a problem on the dialog but you can’t tell them what’s wrong using a message box. This seems like a rather serious defect. Am I doing something incorrectly or is this indeed a defect?

Art Wilkes Dec 8, 2014 - 9:00 AM


Use m_hWnd as messagebox parent:

if ( ProfUISMsgBox(m_hWnd, "The file already exists. Overwrite?", "Confirm choice", MB_YESNO) == IDNO )
return;

Prof-UIS Support

Art Wilkes Dec 4, 2014 - 10:08 AM

Thanks
We have referred this to our support group for disposition.
Prof-UIS