diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 347ed299f5..27b03bfd52 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -2024,8 +2024,8 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) if ( (nMsg >= WM_MOUSEFIRST) && (nMsg <= WM_MOUSELAST) ) { - // we only process mouse messages here and these parameters have the same - // meaning for all of them + // we only process mouse messages here and these parameters have the + // same meaning for all of them int x = GET_X_LPARAM(lParam), y = GET_Y_LPARAM(lParam); HTREEITEM htItem = GetItemFromPoint(GetHwnd(), x, y); @@ -2226,6 +2226,19 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) } } #endif // !wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE + else if ( nMsg == WM_CHAR ) + { + // don't let the control process Space and Return keys because it + // doesn't do anything useful with them anyhow but always beeps + // annoyingly when it receives them and there is no way to turn it off + // simply if you just process TREEITEM_ACTIVATED event to which Space + // and Enter presses are mapped in your code + if ( wParam == VK_SPACE || wParam == VK_RETURN ) + { + processed = true; + } + } + if ( !processed ) rc = wxControl::MSWWindowProc(nMsg, wParam, lParam); @@ -2412,6 +2425,8 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) eventType = wxEVT_COMMAND_TREE_SEL_CHANGING; //else: already set above + NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam; + if (hdr->code == TVN_SELCHANGINGW || hdr->code == TVN_SELCHANGEDW) {