Fix Tab navigation when focused control is disabled.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -590,6 +590,8 @@ protected:
|
||||
int& x, int& y,
|
||||
int& w, int& h) const;
|
||||
|
||||
bool MSWEnableHWND(WXHWND hWnd, bool enable);
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
@@ -403,7 +403,7 @@ bool wxRadioBox::Enable(unsigned int item, bool enable)
|
||||
wxCHECK_MSG( IsValid(item), false,
|
||||
wxT("invalid item in wxRadioBox::Enable()") );
|
||||
|
||||
BOOL ret = ::EnableWindow((*m_radioButtons)[item], enable);
|
||||
BOOL ret = MSWEnableHWND((*m_radioButtons)[item], enable);
|
||||
|
||||
return (ret == 0) != enable;
|
||||
}
|
||||
|
@@ -625,7 +625,7 @@ bool wxSpinCtrl::Enable(bool enable)
|
||||
return false;
|
||||
}
|
||||
|
||||
::EnableWindow(GetBuddyHwnd(), enable);
|
||||
MSWEnableHWND(GetBuddyHwnd(), enable);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -699,9 +699,21 @@ wxWindow *wxWindowBase::DoFindFocus()
|
||||
|
||||
void wxWindowMSW::DoEnable( bool enable )
|
||||
{
|
||||
HWND hWnd = GetHwnd();
|
||||
if ( hWnd )
|
||||
::EnableWindow(hWnd, (BOOL)enable);
|
||||
MSWEnableHWND(GetHwnd(), enable);
|
||||
}
|
||||
|
||||
bool wxWindowMSW::MSWEnableHWND(WXHWND hWnd, bool enable)
|
||||
{
|
||||
if ( !hWnd )
|
||||
return false;
|
||||
|
||||
// If disabling focused control, we move focus to the next one, as if the
|
||||
// user pressed Tab. That's because we can't keep focus on a disabled
|
||||
// control, Tab-navigation would stop working then.
|
||||
if ( !enable && ::GetFocus() == hWnd )
|
||||
Navigate();
|
||||
|
||||
return ::EnableWindow(hWnd, (BOOL)enable);
|
||||
}
|
||||
|
||||
bool wxWindowMSW::Show(bool show)
|
||||
|
Reference in New Issue
Block a user