Thank you for reporting this issue. To fix it, please update the source code for the CExtPopupMenuWnd::_OnKeyDown()
method in the ..\Prof-UIS\Src\ExtPopupMenuWnd.cpp file
bool CExtPopupMenuWnd::_OnKeyDown(
UINT nChar,
UINT nRepCnt,
UINT nFlags,
bool & bNoEat
)
{
ASSERT_VALID( this );
nFlags;
ASSERT( m_hWndCmdReceiver != NULL );
ASSERT( ::IsWindow(m_hWndCmdReceiver) );
nRepCnt;
if( GetSafeHwnd() == NULL )
return true;
if( ! m_bAnimFinished )
return true;
if( _IsResizingMode() )
return true;
CExtPopupMenuSite & _site = GetSite();
if( _site.IsShutdownMode()
|| _site.IsEmpty()
|| _site.GetAnimated() != NULL
)
return true;
TranslateKeyboardEventData_t _td( this, nChar, nRepCnt, nFlags, bNoEat );
if( _td.Notify() )
{
bNoEat = _td.m_bNoEat;
return true;
}
bool bAlt =
( (::GetAsyncKeyState(VK_MENU)&0x8000) != 0 )
? true : false;
bool bCtrl =
( (::GetAsyncKeyState(VK_CONTROL)&0x8000) != 0 )
? true : false;
bool bShift =
( (::GetAsyncKeyState(VK_SHIFT)&0x8000) != 0 )
? true : false;
HWND hWndFocus = ::GetFocus();
if( hWndFocus != NULL
&& (::GetWindowLong(hWndFocus,GWL_STYLE)&WS_CHILD) != 0
&& ::GetParent(hWndFocus) == m_hWnd
&& ( nChar != VK_RETURN
|| m_nCurIndex < 0
|| (! ItemGetInfo(m_nCurIndex).IsInplaceEdit() )
)
)
{
if( bAlt )
PostMessage( WM_CANCELMODE );
else if( nChar == VK_ESCAPE )
SetFocus();
else if( (nChar == VK_INSERT || nChar == _T(’C’)) && bCtrl )
::SendMessage( hWndFocus, WM_COPY, 0, 0 );
else if( ( nChar == _T(’X’) && bCtrl )
|| ( nChar == VK_DELETE && bShift )
)
::SendMessage( hWndFocus, WM_CUT, 0, 0 );
else if( ( nChar == _T(’V’) && bCtrl )
|| ( nChar == VK_INSERT && bShift )
)
::SendMessage( hWndFocus, WM_PASTE, 0, 0 );
else if( nChar == VK_DELETE )
::SendMessage( hWndFocus, CExtPopupMenuWnd::CInPlaceEditWnd::g_nMsgDeleteSelection, 0, 0 );
else if( nChar == _T(’A’) && bCtrl )
::SendMessage( hWndFocus, CExtPopupMenuWnd::CInPlaceEditWnd::g_nMsgSelectAll, 0, 0 );
else
bNoEat = true;
return (!bNoEat);
}
next_item_t nit = __NI_NOTHING;
if( nChar == VK_TAB && (! ( bCtrl || bAlt ) ) )
{
if( _IsPalette()
&& ItemGetCount() > 0
&& m_nCurIndex >= 0
&& m_nCurIndex <= (ItemGetCount() - 1)
&& ItemGetInfo(m_nCurIndex).IsToolButton()
)
nChar = bShift ? VK_LEFT : VK_RIGHT;
else
nChar = bShift ? VK_UP : VK_DOWN;
}
bool bRTL = OnQueryLayoutRTL();
if( bRTL
&& ( nChar == VK_LEFT
|| nChar == VK_RIGHT
)
)
nChar = (nChar == VK_LEFT) ? VK_RIGHT : VK_LEFT;
switch( nChar )
{
case VK_MENU:
_EndSequence();
return true;
case VK_SPACE:
return true;
case VK_F4:
{
if( m_nCurIndex < 0 )
return true;
MENUITEMDATA & mi = ItemGetInfo( m_nCurIndex );
if( mi.IsExtraMark() )
return true;
if( ! ( mi.IsInplaceEdit() && mi.IsPopup() ) )
return true;
if( mi.GetPopup()->GetSafeHwnd() == NULL )
{
HWND hWndOwn = m_hWnd;
_ItemFocusSet(
m_nCurIndex,
TRUE,
TRUE
);
if( ! ::IsWindow( hWndOwn ) )
return true;
}
return true;
}
case VK_RETURN:
{
if( m_nCurIndex < 0 )
{
INT nPos = ItemDefaultFind();
if( nPos < 0 )
return true; // break;
_ItemFocusSet(
nPos,
FALSE,
TRUE,
TRUE
);
}
MENUITEMDATA & mi = ItemGetInfo( m_nCurIndex );
if( mi.IsInplaceEdit() )
{
CWnd * pWndInplace = mi.GetInplaceEditPtr();
if( pWndInplace != NULL )
{
ASSERT_VALID( pWndInplace );
ASSERT( pWndInplace->GetSafeHwnd() != NULL && (::IsWindow(pWndInplace->GetSafeHwnd())) );
if( mi.IsAllowInplaceEditActivation() )
{
if( (pWndInplace->GetStyle() & WS_VISIBLE) == 0 )
{
CRect rcInplaceEdit;
_GetItemRect( m_nCurIndex, rcInplaceEdit );
rcInplaceEdit =
mi.AdjustInplaceEditRect(
rcInplaceEdit,
OnQueryLayoutRTL()
);
pWndInplace->SetWindowPos(
NULL,
rcInplaceEdit.left, rcInplaceEdit.top,
rcInplaceEdit.Width(), rcInplaceEdit.Height(),
SWP_NOZORDER|SWP_NOOWNERZORDER
|SWP_NOACTIVATE|SWP_SHOWWINDOW
);
pWndInplace->SetFocus();
} // if( (pWndInplace->GetStyle() & WS_VISIBLE) == 0 )
else
{
bNoEat = true;
return false;
}
} // if( mi.IsAllowInplaceEditActivation() )
} // if( pWndInplace != NULL )
return true;
}
if( mi.IsExtraMark() && (! _FindHelpMode() ) )
{
ASSERT( mi.GetExtraMarkCallback() != NULL );
mi.GetExtraMarkCallback()( this, &mi );
CClientDC dc( this );
_DoPaint( dc );
return true;
} // if( mi.IsExtraMark() ....
if( mi.IsExecutableCmdID()
|| ( mi.IsPopup()
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
&& mi.GetCmdNode() != NULL
&& (mi.GetCmdNode()->GetFlags()&__ECTN_TBB_SEPARATED_DROPDOWN) != 0
&& (mi.GetCmdNode()->GetFlags()&(__ECTN_TBB_COLOR|__ECTN_TBB_UNDO_REDO)) != 0
#else // (!defined __EXT_MFC_NO_CUSTOMIZE)
&& ( mi.GetPopup()->IsKindOf( RUNTIME_CLASS(CExtPopupColorMenuWnd) )
#if (!defined __EXT_MFC_NO_UNDO_REDO_POPUP)
|| mi.GetPopup()->IsKindOf( RUNTIME_CLASS(CExtPopupUndoRedoMenuWnd) )
#endif // (!defined __EXT_MFC_NO_UNDO_REDO_POPUP)
)
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
)
)
{
if( !( mi.GetCmdDeliverCb() != NULL
&& mi.GetCmdDeliverCb()( this, &mi )
)
)
{
_CancelingSet();
_EndSequenceEx( mi );
}
return true;
}
} // case VK_RETURN
case VK_RIGHT:
{
if( _IsPalette()
&& ItemGetCount() > 0
&& m_nCurIndex >= 0
&& m_nCurIndex <= (ItemGetCount() - 1)
&& (! ItemGetInfo(m_nCurIndex).IsPopup() )
)
{
nit = __NI_NEXT;
break;
}
bool bSendChangeMenu = false;
if( m_nCurIndex < 0 )
{
if( m_items_all.GetSize() == 0 )
return true; // false;
// nit = __NI_ANY;
bSendChangeMenu = true;
}
else
{
MENUITEMDATA & mi = ItemGetInfo(m_nCurIndex);
if( !mi.IsPopup() )
{
bSendChangeMenu = true;
}
else
{
if( mi.GetPopup()->GetSafeHwnd() == NULL )
{
HWND hWndOwn = m_hWnd;
_ItemFocusDelay();
if( ! ::IsWindow( hWndOwn ) )
return true;
_ItemFocusSet(
m_nCurIndex,
TRUE,
TRUE
);
if( ! ::IsWindow( hWndOwn ) )
return true;
}
}
}
if( bSendChangeMenu && nChar==VK_RIGHT )
{
ASSERT( m_hWndCmdReceiver != NULL );
ASSERT( ::IsWindow(m_hWndCmdReceiver) );
if( CExtToolControlBar::g_bMenuTracking )
::PostMessage(
m_hWndCmdReceiver,
bRTL ? CExtPopupMenuWnd::g_nMsgPopupPrev : CExtPopupMenuWnd::g_nMsgPopupNext,
0,
LPARAM( this )
);
return true;
}
}
break; // case VK_RIGHT
case VK_ESCAPE:
if( m_bTopLevel )
{
_EndSequence();
return true;
}
case VK_LEFT:
if( nChar == VK_LEFT
&& _IsPalette()
&& ItemGetCount() > 0
&& m_nCurIndex >= 0
)
{
nit = __NI_PREV;
break;
}
else if( m_pWndParentMenu == NULL )
{
if( CExtToolControlBar::g_bMenuTracking )
::PostMessage(
m_hWndCmdReceiver,
bRTL ? CExtPopupMenuWnd::g_nMsgPopupNext : CExtPopupMenuWnd::g_nMsgPopupPrev,
0,
LPARAM( this )
);
return true;
}
else
{
ASSERT( !m_bTopLevel );
int nParentCurIndex =
m_pWndParentMenu->m_nCurIndex;
ASSERT(
nParentCurIndex >= 0
&&
nParentCurIndex <=
m_pWndParentMenu->m_items_all.GetSize()
);
HWND hWndOwn = m_hWnd;
m_pWndParentMenu->_SetCapture();
m_pWndParentMenu->_ItemFocusCancel(
FALSE
);
m_pWndParentMenu->_ItemFocusSet(
nParentCurIndex,
FALSE,
TRUE
);
if( ! ::IsWindow( hWndOwn ) )
return true;
m_pWndParentMenu->_SetCapture();
return true;
}
// case VK_ESCAPE:
// _EndSequence();
// return true;
case VK_UP:
if( nChar == VK_UP
&& ItemGetCount() > 0
&& 0 <= m_nCurIndex
&& m_nCurIndex < ItemGetCount()
&& (! ItemGetInfo(m_nCurIndex).IsIconMode() )
)
nit = __NI_PREV;
else
nit = _IsPalette() ? __NI_ROW_PREV : __NI_PREV;
break; // case VK_UP
case VK_DOWN:
if( IsKeyPressed( VK_CONTROL ) )
{
if( m_bExpandAvailable )
_DoExpand();
return true;
}
if( ItemGetCount() > 0
&& 0 <= m_nCurIndex
&& m_nCurIndex < ItemGetCount()
&& (! ItemGetInfo(m_nCurIndex).IsIconMode() )
)
nit = __NI_NEXT;
else
nit = _IsPalette() ? __NI_ROW_NEXT : __NI_NEXT;
break; // case VK_DOWN
case VK_NEXT:
nit = __NI_PAGE_DOWN;
break; // case VK_NEXT
case VK_PRIOR:
nit = __NI_PAGE_UP;
break; // case VK_PRIOR
default:
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
if( _KeyTipsEnabledGet() )
{ // BLOCK: key tip processing
if( ( _T(’A’) <= nChar && nChar <= _T(’Z’) )
|| ( _T(’0’) <= nChar && nChar <= _T(’9’) )
)
{
if( _KeyTipsTranslate( nChar ) )
return true;
}
} // BLOCK: key tip processing
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
{ // BLOCK: try analyze quick char access
if( IsKeyPressed(VK_SHIFT)
|| IsKeyPressed(VK_CONTROL)
// || IsKeyPressed(VK_MENU)
// || ( (nFlags & (1<<29)) != 0 ) // ALT pressed?
)
return false;
BYTE lpKeyState[256];
::GetKeyboardState( lpKeyState );
UINT wScanCode = ::MapVirtualKey( nChar, 0 );
HKL hKeyboardLayout =
::GetKeyboardLayout(
( ::AfxGetThread() ) -> m_nThreadID
);
#if (defined _UNICODE)
TCHAR szChar[2] = { _T(’\0’), _T(’\0’) };
::ToUnicodeEx(
nChar,
wScanCode,
lpKeyState,
szChar, 1,
1,
hKeyboardLayout
);
WORD nMapped = WORD( szChar[0] );
#else
WORD nMapped = 0;
::ToAsciiEx(
nChar,
wScanCode,
lpKeyState,
&nMapped,
1,
hKeyboardLayout
);
//TCHAR szChar[2] = { (TCHAR)nMapped, _T(’\0’) };
#endif
BOOL bSearchDisplayedOnly = FALSE;
INT nNextIdx =
ItemFindByAccessChar(
(TCHAR)nMapped,
m_nCurIndex,
TRUE,
bSearchDisplayedOnly
);
if( (! bSearchDisplayedOnly )
&& nNextIdx >= 0
&& m_bExpandAvailable
&& (! m_bExpandWasPressed )
)
{
MENUITEMDATA & miNext = ItemGetInfo( nNextIdx );
if( (! miNext.IsDisplayed() )
&& ( ItemFindByAccessChar(
(TCHAR)nMapped,
nNextIdx,
TRUE,
bSearchDisplayedOnly
) >= 0
|| miNext.IsPopup()
)
)
{
KillTimer( ID_TIMER_DELAY_EXPAND );
bool bSavedMenuExpandAnimation = g_bMenuExpandAnimation;
g_bMenuExpandAnimation = false;
_DoExpand();
_EndAnimation();
KillTimer( ID_TIMER_ANIMATION );
m_bAnimFinished = true;
GetSite().SetAnimated( NULL );
_DoReCreateShadows();
g_bMenuExpandAnimation = bSavedMenuExpandAnimation;
CClientDC dc( this );
_DoPaint( dc );
}
if( miNext.IsPopup() )
{
_ItemFocusSet( nNextIdx, TRUE, TRUE, TRUE );
return true;
}
}
if( nNextIdx < 0
&& m_nCurIndex >= 0
&& ItemFindByAccessChar(
(TCHAR)nMapped,
-1,
TRUE,
bSearchDisplayedOnly
)
== m_nCurIndex
)
{ // if only 1 with this char
MENUITEMDATA & mi = ItemGetInfo( m_nCurIndex );
if( mi.IsInplaceEdit() && (!mi.IsPopup()) )
{
CWnd * pWndInplace = mi.GetInplaceEditPtr();
if( pWndInplace != NULL )
{
ASSERT_VALID( pWndInplace );
ASSERT( pWndInplace->GetSafeHwnd() != NULL && (::IsWindow(pWndInplace->GetSafeHwnd())) );
if( mi.IsAllowInplaceEditActivation() )
{
if( (pWndInplace->GetStyle() & WS_VISIBLE) == 0 )
{
CRect rcInplaceEdit;
_GetItemRect( m_nCurIndex, rcInplaceEdit );
rcInplaceEdit =
mi.AdjustInplaceEditRect(
rcInplaceEdit,
OnQueryLayoutRTL()
);
pWndInplace->SetWindowPos(
NULL,
rcInplaceEdit.left, rcInplaceEdit.top,
rcInplaceEdit.Width(), rcInplaceEdit.Height(),
SWP_NOZORDER|SWP_NOOWNERZORDER
|SWP_NOACTIVATE|SWP_SHOWWINDOW
);
} // if( (pWndInplace->GetStyle() & WS_VISIBLE) == 0 )
pWndInplace->SetFocus();
} // if( mi.IsAllowInplaceEditActivation() )
} // if( pWndInplace != NULL )
return true;
} // if( mi.IsInplaceEdit() && (!mi.IsPopup()) )
if( mi.IsExtraMark() && (! _FindHelpMode() ) )
{
ASSERT( mi.GetExtraMarkCallback() != NULL );
mi.GetExtraMarkCallback()( this, &mi );
CClientDC dc( this );
_DoPaint( dc );
return true;
} // if( mi.IsExtraMark() ...
if( mi.IsPopup() )
{
_ItemFocusSet( m_nCurIndex, TRUE, TRUE );
return true;
}
if( mi.IsExecutableCmdID() )
{
if( !( mi.GetCmdDeliverCb() != NULL
&& mi.GetCmdDeliverCb()( this, &mi )
)
)
_EndSequenceEx( mi );
return true;
} // if( mi.IsExecutableCmdID() )
} // if only 1 with this char
if( m_nCurIndex != nNextIdx
&& nNextIdx >= 0
)
{
HWND hWndOwn = m_hWnd;
_ItemFocusSet( nNextIdx, TRUE, TRUE );
if( ! ::IsWindow( hWndOwn ) )
return true;
if( ItemFindByAccessChar(
(TCHAR)nMapped,
nNextIdx
) < 0
)
{ // if only 1 with this char
MENUITEMDATA & mi =
ItemGetInfo( nNextIdx );
if( mi.IsInplaceEdit() && (!mi.IsPopup()) )
{
CWnd * pWndInplace = mi.GetInplaceEditPtr();
if( pWndInplace != NULL )
{
ASSERT_VALID( pWndInplace );
ASSERT( pWndInplace->GetSafeHwnd() != NULL && (::IsWindow(pWndInplace->GetSafeHwnd())) );
if( mi.IsAllowInplaceEditActivation() )
{
if( (pWndInplace->GetStyle() & WS_VISIBLE) == 0 )
{
CRect rcInplaceEdit;
_GetItemRect( nNextIdx, rcInplaceEdit );
rcInplaceEdit =
mi.AdjustInplaceEditRect(
rcInplaceEdit,
OnQueryLayoutRTL()
);
pWndInplace->SetWindowPos(
NULL,
rcInplaceEdit.left, rcInplaceEdit.top,
rcInplaceEdit.Width(), rcInplaceEdit.Height(),
SWP_NOZORDER|SWP_NOOWNERZORDER
|SWP_NOACTIVATE|SWP_SHOWWINDOW
);
} // if( (pWndInplace->GetStyle() & WS_VISIBLE) == 0 )
pWndInplace->SetFocus();
} // if( mi.IsAllowInplaceEditActivation() )
} // if( pWndInplace != NULL )
return true;
} // if( mi.IsInplaceEdit() && (!mi.IsPopup()) )
if( mi.IsExtraMark() && (! _FindHelpMode() ) )
{
ASSERT( mi.GetExtraMarkCallback() != NULL );
mi.GetExtraMarkCallback()( this, &mi );
CClientDC dc( this );
_DoPaint( dc );
return true;
} // if( mi.IsExtraMark() ...
if( mi.IsExecutableCmdID()
//&& ( ! mi.IsPopup() )
&& _GetCapture() == this
)
{
if( !( mi.GetCmdDeliverCb() != NULL
&& mi.GetCmdDeliverCb()( this, &mi )
)
)
{
_CancelingSet();
_EndSequenceEx( mi );
}
return true;
} // if( mi.IsExecutableCmdID() )
} // if only 1 with this char
return true;
}
} // BLOCK: try analyze quick char access
{ // BLOCK: help key processing
const ACCEL * pAccel = _GetTranslatedContextHelpAccel();
if( m_nCurIndex >= 0
&& pAccel != NULL
&& nChar == WPARAM(pAccel->key)
&& (pAccel->fVirt&(FSHIFT|FCONTROL|FALT)) ==
( 0
| ( bShift ? (FSHIFT) : 0 )
| ( bCtrl ? (FCONTROL) : 0 )
| ( bAlt ? (FALT) : 0 )
)
)
{
MENUITEMDATA & mi = ItemGetInfo( m_nCurIndex );
if( ( ! mi.IsPopup() ) && ( ! mi.IsExtraMark() ) )
{
UINT nHitTestCmdID = mi.GetCmdID();
bNoEat = false;
_EndSequence();
::AfxGetApp()->WinHelp( nHitTestCmdID, HELP_CONTEXT );
return true;
} // if( ( ! mi.IsPopup() ) && ( ! mi.IsExtraMark() ) )
} // if( m_nCurIndex >= 0 ...
} // BLOCK: help key processing
} // switch( nChar )
if( nit != __NI_NOTHING )
{
int nItemIndex = _GetNextItem(nit);
if( m_items_all.GetSize() > 0
&& nItemIndex >= 0
&& nItemIndex != m_nCurIndex
)
{
HWND hWndOwn = m_hWnd;
_ItemFocusSet(
nItemIndex,
FALSE,
TRUE
);
if( ! ::IsWindow( hWndOwn ) )
return true;
return true; // false;
}
if( nItemIndex == IDX_EXPAND )
{
ASSERT( m_bExpandAvailable );
ASSERT( !m_bExpandWasPressed );
int nItemIndex = m_nCurIndex;
HWND hWndOwn = m_hWnd;
_DoExpand();
if( ! ::IsWindow( hWndOwn ) )
return true;
if( nItemIndex >= 0 )
{
HWND hWndOwn = m_hWnd;
_ItemFocusSet(
nItemIndex,
FALSE,
//m_bAnimFinished
( GetSite().GetAnimated() == NULL )
? TRUE : FALSE
);
if( ! ::IsWindow( hWndOwn ) )
return true;
int i = _GetNextItem(__NI_NEXT);
_ItemFocusSet(
(i>0) ? i : nItemIndex,
FALSE,
//m_bAnimFinished
( GetSite().GetAnimated() == NULL )
? TRUE : FALSE
);
if( ! ::IsWindow( hWndOwn ) )
return true;
}
return true;
}
} // if( nit != __NI_NOTHING )
return false;
}