fixed annoying beep when pressing space/return in the tree

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-12-09 16:41:04 +00:00
parent dba06cd016
commit 7bb8798ce7

View File

@ -2024,8 +2024,8 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
if ( (nMsg >= WM_MOUSEFIRST) && (nMsg <= WM_MOUSELAST) ) if ( (nMsg >= WM_MOUSEFIRST) && (nMsg <= WM_MOUSELAST) )
{ {
// we only process mouse messages here and these parameters have the same // we only process mouse messages here and these parameters have the
// meaning for all of them // same meaning for all of them
int x = GET_X_LPARAM(lParam), int x = GET_X_LPARAM(lParam),
y = GET_Y_LPARAM(lParam); y = GET_Y_LPARAM(lParam);
HTREEITEM htItem = GetItemFromPoint(GetHwnd(), x, y); 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 #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 ) if ( !processed )
rc = wxControl::MSWWindowProc(nMsg, wParam, lParam); 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; eventType = wxEVT_COMMAND_TREE_SEL_CHANGING;
//else: already set above //else: already set above
NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam;
if (hdr->code == TVN_SELCHANGINGW || if (hdr->code == TVN_SELCHANGINGW ||
hdr->code == TVN_SELCHANGEDW) hdr->code == TVN_SELCHANGEDW)
{ {