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 General Discussion » Bug on the Prof-UIS message boxes? Collapse All
Subject Author Date
Nicolas Pinaud Oct 28, 2009 - 8:46 AM

Hi,


 


First, sorry for my english but i’m french...


 


I’m using Prof-UIS message boxes.


For this, I put the IMPLEMENT_CWinAPP_DoMessageBox; line of code into declaration of the CWinApp-derived class. This will replace all the ::AfxMessageBox() message boxes with Prof-UIS message boxes.


 


Everything it’s ok or almost...


 


In a dialog box, i use the ActiveX Microsoft UpDown Control 6.0 (SP6).


When i want to show an AfxMessageBox on the events DownClik and UpClick of the Updown Control, there is a problem.


The message box is show correctly but all clicks on there are intercepted by the Updown Control.


It’s like the focus is not lost by the UpDown Control when a message box is show.


 


Do you this problem?


 


Thanks for your answers.

Technical Support Oct 30, 2009 - 2:29 PM

Yes, this small improvement is part of Prof-UIS 2.87.

Technical Support Oct 28, 2009 - 9:45 AM

Could you provide us with a simple test project demonstrating this issue?

Nicolas Pinaud Oct 29, 2009 - 10:23 AM

Have you received my mail with a simple test project?

Technical Support Oct 29, 2009 - 2:15 PM

Thank you for the test project. We handled the OK and Cancel button clicks in your test project:

void CTestUpDownDlg::OnOK()
{
//    CDialog::OnOK();
      AfxMessageBox("OnOK");
}

void CTestUpDownDlg::OnCancel()
{
//    CDialog::OnCancel();
      AfxMessageBox("OnCancel");
}
And both buttons correctly stay focused after the message box is closed. The up-down ActiveX control cannot be tested for focus restoring. It has much more serious problem. It does not release mouse capture when it fires its events. We understand it requires mouse capture for mouse click tracking. But this causes multiple message box displaying. Probably message box should not be displayed while handling these events or, at least, you should release mouse capture manually:
void CTestUpDownDlg::OnDownClickUpdownTest()
{
      ReleaseCapture();
      AfxMessageBox("OnDownClickUpdownTest");
}

void CTestUpDownDlg::OnUpClickUpdownTest()
{
      ReleaseCapture();
      AfxMessageBox("OnUpClickUpdownTest");
}

Even in this case the focused state of the up-down control is not restored correctly and you may need to focus it manually. So, we decided to make Prof-UIS message box force releasing the mouse capture in its code:
int CExtMsgBox::DoMsgBox(
      HWND hWndParent,
      __EXT_MFC_SAFE_LPCTSTR strMessageText,
      __EXT_MFC_SAFE_LPCTSTR strCaption, // = NULL
      UINT nMsgBoxStyle, // = __EXT_MB_DEFAULT_STYLES
      UINT nHelpID, // = 0
      __EXT_MFC_SAFE_LPCTSTR strUniqueID, // = NULL // for __EXT_MB_DO_NOT_DISPLAY_AGAIN and __EXT_MB_DO_NOT_ASK_AGAIN
      UINT nMsgBoxStyleEx, // = __EXT_MB_EX_DEFAULT_STYLES
      UINT nTimeoutSeconds, // = 0
      bool bIsDisabledTimeout, // = false
      CExtBitmap * pBmpIcon // = NULL
      )
{
__PROF_UIS_MANAGE_STATE;
      if( ::GetCapture() != NULL )
            ::ReleaseCapture(); // force release mouse capture
CExtMsgBox dlg( hWndParent, strMessageText, strCaption, nMsgBoxStyle, nHelpID, strUniqueID, nMsgBoxStyleEx );
      if( nTimeoutSeconds > 0 )
            dlg.TimeoutSet( nTimeoutSeconds, bIsDisabledTimeout );
      if( pBmpIcon != NULL && ( ! pBmpIcon->IsEmpty() ) )
            dlg.m_bmpIcon = (*pBmpIcon);
      return int( dlg.DoModal() );
}
This fixes behavior of the up-down control. Probably the AfxMessageBox() API force releases capture too. But both Prof-UIS and MFC message boxes does not set focus back to the up down control (we tried to comment the IMPLEMENT_CWinAPP_DoMessageBox line of code).

Nicolas Pinaud Oct 30, 2009 - 3:01 AM

I have modified the source file, and now all works fine.


 


Did you include this in the next release?


 


Anyhow, Thank you for your reactivity and your help.