I'm using the CMFCMenuBar class to display my main frame menu, the menu contains access keys like "&File" when the user press Alt + F It will open the File menu, but this is not working for me it shows a line under the access key and after pressing Alt the first menu item in the main menu highlight and I can navigate using the arrows key (Up, Down, Right, Left) but not the access keys
As we see the menu items has line under the access key but it is not working how to trace it?
That was fixed after some search I traced the processing of the key
I reached this MFC code
BOOL CMFCToolBar::TranslateChar(UINT nChar)
{
if (!CKeyboardManager::IsKeyPrintable(nChar))
{
return FALSE;
}
UINT nUpperChar = CKeyboardManager::TranslateCharToUpper(nChar);//this line guided me
CMFCToolBarButton* pButton = NULL;
if (!m_AccelKeys.Lookup(nUpperChar, pButton))
{
return FALSE;
}
ASSERT_VALID(pButton);
// Save animation type and disable animation:
CMFCPopupMenu::ANIMATION_TYPE animType = CMFCPopupMenu::GetAnimationType();
CMFCPopupMenu::SetAnimationType(CMFCPopupMenu::NO_ANIMATION);
BOOL bRes = DropDownMenu(pButton);
// Restore animation:
CMFCPopupMenu::SetAnimationType(animType);
if (bRes)
{
return TRUE;
}
return ProcessCommand(pButton);
}
I traced this line CKeyboardManager::TranslateCharToUpper(nChar); it start with
UINT __stdcall CKeyboardManager::TranslateCharToUpper(const UINT nChar)
{
if (nChar < VK_NUMPAD0 || nChar > VK_NUMPAD9 ||
(::GetAsyncKeyState(VK_MENU) & 0x8000))
{
if (!CMFCToolBar::m_bExtCharTranslation)
{
I searched for the CMFCToolBar::m_bExtCharTranslation, I got that bug report http://connect.microsoft.com/VisualStudio/feedback/details/525656/hot-key-is-not-working-on-russian-language-for-applications-which-uses-mfc-feature-pack
we needed the following addition in the startup of the application I put it in the method CMainFrame::OnCreate
CMFCToolBar::m_bExtCharTranslation = TRUE;//it is FALSE by default