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 » Having trouble with Menu Accelerators in a child CExtResizeableDialog of CExtNCW < CFrameWnd > Collapse All
Subject Author Date
Scott Moore Jan 11, 2007 - 9:16 AM

I’m having trouble with my menu items when I use keyboard accelerators to invoke them. I believe the problem is because I handle the message in a child class of CFrameWnd which is a CExtResizeableDlg.

Everything works fine if I select the menu item with the mouse. And the keyboard accelerator works fine anytime I have previously selected a menu item from the application. But if I set focus to my CExtGrid control and try the accelerator, it never works. I assume this is a problem with PreTranslateMsg(), but I’m not sure how to fix it.

My window hierarchy is this:

CExtNCW < CFrameWnd >
    CExtTabPageContainerWnd
        CExtResizableDialog <<< handles menu item
        
Thanks,
Scott

            

Technical Support Jan 14, 2007 - 1:09 PM

The problem is caused by the message pre-translation implemented in the CDialog class. Everything should work if you override the CWnd::PreTranslateMessage() virtual method in your dialog class:

BOOL CYourDialogClass::PreTranslateMessage( MSG * pMSG )
{
    if(     WM_KEYFIRST <= pMSG->message && pMSG->message <= WM_KEYLAST
        &&  ( pMSG->wParam == VK_TAB || pMSG->wParam == VK_UP || pMSG->wParam == VK_DOWN )
        )
        return CExtResizableDialog::PreTranslateMessage( pMSG );
    else
        return CWnd::PreTranslateMessage( pMSG );
}

Scott Moore Jan 12, 2007 - 6:31 AM

No, my grid is read only. It just happens if you select a row or the grid gets focus.

Suhai Gyorgy Jan 12, 2007 - 3:34 AM

Does it happen when you use inplace editor of a cell in your CExtGridWnd?