X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0bf68d697a37d75ac9439745a3a2ac55bd25ddf..79b7b95aed76eb742deef93d046886c20452fb36:/src/msw/treectrl.cpp diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index d705b7e6a8..63019b5e22 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -1948,7 +1948,9 @@ bool wxTreeCtrl::MSWShouldPreProcessMessage(WXMSG* msg) { if ( msg->message == WM_KEYDOWN ) { - if ( msg->wParam == VK_RETURN ) + // Only eat VK_RETURN if not being used by the application in + // conjunction with modifiers + if ( (msg->wParam == VK_RETURN) && !wxIsAnyModifierDown() ) { // we need VK_RETURN to generate wxEVT_COMMAND_TREE_ITEM_ACTIVATED return false; @@ -2164,7 +2166,7 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara // fire EVT_RIGHT_DOWN HandleMouseEvent(nMsg, x, y, wParam); - + // send NM_RCLICK NMHDR nmhdr; nmhdr.hwndFrom = GetHwnd(); @@ -2174,7 +2176,7 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara nmhdr.idFrom, (LPARAM)&nmhdr); // prevent tree control default processing, as we've - // already done everything + // already done everything processed = true; } break; @@ -2603,8 +2605,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // fabricate the lParam and wParam parameters sufficiently // similar to the ones from a "real" WM_KEYDOWN so that // CreateKeyEvent() works correctly - const bool isAltDown = ::GetKeyState(VK_MENU) < 0; - WXLPARAM lParam = (isAltDown ? KF_ALTDOWN : 0) << 16; + WXLPARAM lParam = (wxIsAltDown() ? KF_ALTDOWN : 0) << 16; WXWPARAM wParam = info->wVKey; @@ -2622,7 +2623,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) wParam); // a separate event for Space/Return - if ( !wxIsCtrlDown() && !wxIsShiftDown() && !isAltDown && + if ( !wxIsAnyModifierDown() && ((info->wVKey == VK_SPACE) || (info->wVKey == VK_RETURN)) ) { wxTreeItemId item; @@ -2640,7 +2641,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // Vista's tree control has introduced some problems with our // multi-selection tree. When TreeView_SelectItem() is called, // the wrong items are deselected. - + // Fortunately, Vista provides a new notification, TVN_ITEMCHANGING // that can be used to regulate this incorrect behavior. The // following messages will allow only the unlocked item's selection @@ -2657,7 +2658,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { // item's state is locked, don't allow the change // returning 1 will disallow the change - *result = 1; + *result = 1; return true; } }