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 » CExtWS and PreTranslateMessage() Collapse All
Subject Author Date
Andrew Harding Oct 21, 2005 - 11:45 AM


CExtWS

Andrew Harding Oct 21, 2005 - 11:54 AM

blah sorry my keyboard suffered from temporary insanity.


I have a CExtWA<CExtADLG<CDialog>> and I’m trying to add a CNTRL+F accelerator key to it.  It seems however that CExtWS::PreTranslateMessage() is eating up the messages so that my dialog’s PreTranslateMessage() is never called.  How do I get around this problem?  A snippit of my code is listed below:


typedef CExtWA<CExtADLG<CDialog>> CMyResizableDialogBase;


class MyDialog : public CMyResizableDialogBase


{
...


};


MyDialog::OnInitDialog()


{


m_hAccel = LoadAccelerators( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDD_ACCEL ) );


}


BOOL MyDialog::PreTranslateMessage(MSG* pMsg)


{


if (WM_KEYFIRST <= pMsg->message &&


pMsg->message <= WM_KEYLAST)


{


if (m_hAccel &&


::TranslateAccelerator(m_hWnd, m_hAccel, pMsg))


return TRUE;


}


return CMyResizableDialogBase::PreTranslateMessage(pMsg);


}

Technical Support Oct 22, 2005 - 8:22 AM

The accelarators should work OK if it is the modal dialog box or main dialog window. Please let us know which kind of dialog is discussed in your message: pop-up modal, pop-up non-modal or a child form? In case of pop-up non-modal or child dialog, you need to analyze the focused window and perform the message pre-translation into your dialog from its parent window.

Andrew Harding Oct 21, 2005 - 3:34 PM

I’ve been trying to create a smaller project to reproduce this problem but those attempts have been unsuccessful, I’m thinking it may have something to do with the plugin architecture that I’m using rather than Prof-UIS directly.  My project consists of a plugin manager executable and a plugin DLL.  The modeless dialog box that is experiencing the PreTranslateMessage difficulty is in my Plugin DLL.


I’ll let you know if I find anything more out but for now it appears that the problem is more likely on my side than Prof-UIS.

Technical Support Oct 22, 2005 - 8:19 AM

We may guess the problem occurs because you forgot to redirect keyboard input pretranslation from the main application into the dialog windows in you plugin DLLs.

Additionally we should note that to make your application smaller you can exclude unwanted components from Prof-UIS and rebuild the library. Just uncomment appropriate __EXT_MFC_NO_??? preprocessor symbol definitions at the beginning of the Prof-UIS.h file.

Andrew Harding Oct 24, 2005 - 2:03 PM

We’re using a popup modeless dialog box.


I checked to be sure that we’re calling SendMessage() in the PreTranslateMessage() of the application to send the message to the dialog box in the DLL.  We are passing the messages along, I set a breakpoint in the applications PreTranslateMessage() function where we send the message to the dialog box and that breakpoint gets hit but the breakpoint in our PreTranslateMessage function in the dialog box is not encountered.

Andrew Harding Oct 24, 2005 - 2:45 PM

I found the problem.  I forgot that MFC automatically created another app object for my DLL and I hadn’t implemented the PreTranslateMessage for that app object.  Thanks for all your help.