From 7e0a200b08893e6dede1e57e465b1f7bbf6ddbaa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Jul 2011 22:19:27 +0000 Subject: [PATCH] Don't give focus to wxSearchButton when using keyboard navigation. The search control buttons don't show that they have focus and are not meant to have it anyhow as they are more control decorations than real buttons and their functionality can be activated by pressing "Enter" or "Escape" already from the keyboard. But giving it to them made TAB behave unexpectedly and wrongly when wxSearchCtrl had focus. Override AcceptsFocusFromKeyboard() to return false to correct this. See #12808. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68365 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/srchctlg.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/generic/srchctlg.cpp b/src/generic/srchctlg.cpp index e202bfe62e..d0efcd17b3 100644 --- a/src/generic/srchctlg.cpp +++ b/src/generic/srchctlg.cpp @@ -143,6 +143,13 @@ public: void SetBitmapLabel(const wxBitmap& label) { m_bmp = label; } + // The buttons in wxSearchCtrl shouldn't accept focus from keyboard because + // this would interfere with the usual TAB processing: the user expects + // that pressing TAB in the search control should switch focus to the next + // control and not give it to the button inside the same control. Besides, + // the search button can be already activated by pressing "Enter" so there + // is really no reason for it to be able to get focus from keyboard. + virtual bool AcceptsFocusFromKeyboard() const { return false; } protected: wxSize DoGetBestSize() const -- 2.45.2