Fix creating wxRadioBox with no items in wxUniv

Don't select the first item if there are no items at all.

See #23784.

(cherry picked from commit d282cc96579ff36f00b4c2f1c9aea3cdca9dfa64)
This commit is contained in:
Kvaz1r 2023-08-19 18:16:39 +03:00 committed by Vadim Zeitlin
parent f76ba198eb
commit fce3346a18
2 changed files with 5 additions and 2 deletions

View File

@ -322,6 +322,7 @@ wxOSX:
wxUniv:
- Fix resetting the hint in wxTextCtrl when it gets focus (Kvaz1r, #23511).
- Fix creating wxRadioBox without any items (Kvaz1r, #23784).
3.2.2.1: (released 2023-02-13)

View File

@ -162,7 +162,9 @@ bool wxRadioBox::Create(wxWindow *parent,
wxSize actualSize = GetSize();
DoMoveWindow(actualPos.x, actualPos.y, actualSize.x, actualSize.y);
// radiobox should already have selection so select at least one item
// Select first radio button if we have any buttons at all, as the radiobox
// should always have some selection.
if ( n != 0 )
SetSelection(0);
return true;