diff --git a/src/msw/bmpcbox.cpp b/src/msw/bmpcbox.cpp index d2d48ab06c..1d8fc3fa7b 100644 --- a/src/msw/bmpcbox.cpp +++ b/src/msw/bmpcbox.cpp @@ -127,6 +127,7 @@ void wxBitmapComboBox::RecreateControl() // mouse-wheel behaviour. // wxString value = GetValue(); + int selection = GetSelection(); wxPoint pos = GetPosition(); wxSize size = GetSize(); size.y = GetBestSize().y; @@ -210,6 +211,8 @@ void wxBitmapComboBox::RecreateControl() // Revert the old string value if ( !HasFlag(wxCB_READONLY) ) ChangeValue(value); + else if ( selection != wxNOT_FOUND ) + SetSelection(selection); // If disabled we'll have to disable it again after re-creating if ( !IsEnabled() ) @@ -407,7 +410,7 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items, bool wxBitmapComboBox::OnAddBitmap(const wxBitmap& bitmap) { - if ( wxBitmapComboBoxBase::OnAddBitmap(bitmap) ) + if ( wxBitmapComboBoxBase::OnAddBitmap(bitmap) || !GetCount() ) { // Need to recreate control for a new measureitem call? int prevItemHeight = ::SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);