Better fix for wxSpinCtrlGeneric enabling/disabling bug in wxMSW.
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
This commit is contained in:
parent
be8fbbff66
commit
a2fb9138b2
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user