To really ensure that the window containing the components of wxSpinCtrlGeneric
is never enabled under MSW (as we want to avoid this to ensure that any input
always goes to its children and not the window itself, see #12045), override
DoEnable() and not Enable(). This takes care of the case when the control gets
implicitly disabled because its parent is.
Closes #13142.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70178
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
virtual wxSize DoGetBestSize() const;
virtual void DoMoveWindow(int x, int y, int width, int height);
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);
// generic double valued functions
double DoGetValue() const { return m_value; }
bool DoSetValue(double val);
m_textCtrl->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)
{
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) )
- m_isEnabled = enable;
-
m_spinButton->Enable(enable);
m_textCtrl->Enable(enable);
m_spinButton->Enable(enable);
m_textCtrl->Enable(enable);