diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index 338dd70234..62d2268eff 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -108,6 +108,11 @@ protected: virtual wxSize DoGetBestSize() const; virtual void DoMoveWindow(int x, int y, int width, int height); +#ifdef __WXMSW__ + // and, for MSW, enabling this window itself + virtual void DoEnable(bool enable); +#endif // __WXMSW__ + // generic double valued functions double DoGetValue() const { return m_value; } bool DoSetValue(double val); diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index e9a7a32a37..615e64ea24 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -283,16 +283,24 @@ void wxSpinCtrlGenericBase::SetFocus() m_textCtrl->SetFocus(); } +#ifdef __WXMSW__ + +void wxSpinCtrlGenericBase::DoEnable(bool enable) +{ + // We never enable this control itself, it must stay disabled to avoid + // interfering with the siblings event handling (see e.g. #12045 for the + // kind of problems which arise otherwise). + if ( !enable ) + wxSpinCtrlBase::DoEnable(enable); +} + +#endif // __WXMSW__ + bool wxSpinCtrlGenericBase::Enable(bool enable) { - // Notice that we never enable this control itself, it must stay disabled - // to avoid interfering with the siblings event handling (see e.g. #12045 - // for the kind of problems which arise otherwise). - if ( enable == m_isEnabled ) + if ( !wxSpinCtrlBase::Enable(enable) ) return false; - m_isEnabled = enable; - m_spinButton->Enable(enable); m_textCtrl->Enable(enable);