diff --git a/include/wx/defs.h b/include/wx/defs.h index d92fe25fb8..b850a396d0 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -897,9 +897,6 @@ enum wxStretch // descend into all subwindows #define wxWS_EX_VALIDATE_RECURSIVELY 0x00000001 -// Don't automatically set the focus when left-clicking on the window -#define wxWS_EX_NO_AUTOFOCUS 0x10000000 - /* * wxFrame/wxDialog style flags */ diff --git a/include/wx/tbarbase.h b/include/wx/tbarbase.h index aa19f52861..94d46d6589 100644 --- a/include/wx/tbarbase.h +++ b/include/wx/tbarbase.h @@ -407,6 +407,9 @@ public: // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) virtual void DoToolbarUpdates(); + // Don't want toolbars to accept the focus + bool AcceptsFocus() const { return FALSE; } + protected: // to implement in derived classes // ------------------------------- diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 57dc3bd15b..2a1a5e7ce1 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -205,9 +205,6 @@ bool wxToolBar::Create(wxWindow *parent, long style, const wxString& name) { - // Don't want to grab the focus when we left click - SetExtraStyle(GetExtraStyle() | wxWS_EX_NO_AUTOFOCUS); - // common initialisation if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) return FALSE; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 507019bbf8..e6d0d10345 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1897,7 +1897,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) case WM_LBUTTONDOWN: // set focus to this window - if ((GetExtraStyle() & wxWS_EX_NO_AUTOFOCUS) != wxWS_EX_NO_AUTOFOCUS) + if (AcceptsFocus()) SetFocus(); // fall through