Fix tab navigation bug with radio boxes without enabled items.
There was a bug similar to the one in the preceding commit with radio boxes under wxMSW too: if all radio box buttons were disabled (or hidden, although this should be much more rare in practice, unlike the disabled case which was deemed to be rare in r74583 commit message but turned out to actually happen), the radio box still pretended to accept focus but didn't really do it. Fix this by allowing to override wxWindow::CanBeFocused() and do it in wxRadioBox to check whether we have any enabled visible items. Also add a check for CanBeFocused() to wxControlContainer code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -444,6 +444,25 @@ void wxRadioBox::SetFocus()
|
||||
}
|
||||
}
|
||||
|
||||
bool wxRadioBox::CanBeFocused() const
|
||||
{
|
||||
// If the control itself is hidden or disabled, no need to check anything
|
||||
// else.
|
||||
if ( !wxStaticBox::CanBeFocused() )
|
||||
return false;
|
||||
|
||||
// Otherwise, check if we have any buttons that can be focused.
|
||||
for ( size_t item = 0; item < m_radioButtons->GetCount(); item++ )
|
||||
{
|
||||
if ( IsItemEnabled(item) && IsItemShown(item) )
|
||||
return true;
|
||||
}
|
||||
|
||||
// We didn't find any items that can accept focus, so neither can we as a
|
||||
// whole accept it.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Enable a specific button
|
||||
bool wxRadioBox::Enable(unsigned int item, bool enable)
|
||||
{
|
||||
|
Reference in New Issue
Block a user