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.
Subject |
Author |
Date |
|
Brett Cook
|
Dec 18, 2006 - 8:10 PM
|
Dear Tech Support,
I have a dialog in my application that uses the ON_NOTIFY(TVN_KEYDOWN, ...) message map, but none of the keys that have been defined in the accelerator table get sent there (they’re only sent to the mainframe).
Is there a way to force keypresses that have been defined in the Accelerator table to go to the currently focused dialog?
Thanks, Brett
|
|
Technical Support
|
Dec 19, 2006 - 7:15 AM
|
In the CMainFrame::PreTranslateMessage() method of your project, you should analyze if the focused window is the tree control that requires all key input. In this case you should not invoke the parent class method: BOOL CMainFrame::PreTranslateMessage( MSG * pMsg )
{
if( WM_KEYFIRST <= pMsg->message && pMsg->message <= WM_KEYLAST )
{
HWND hWndYourTreeControl = ...
HWND hWndFocus = ::GetFocus();
if( hWndFocus == hWndYourTreeControl )
return FALSE;
}
return PARENT_CLASS::PreTranslateMessage( pMsg );
}
|
|
Brett Cook
|
Dec 19, 2006 - 1:33 PM
|
Once again, your solution is elegant and solid. Thanks.
|
|