Remember wxBitmapComboBox selection when recreating the control
Recreate the control with the correct height when adding the first item with bitmap.
This commit is contained in:
@@ -127,6 +127,7 @@ void wxBitmapComboBox::RecreateControl()
|
|||||||
// mouse-wheel behaviour.
|
// mouse-wheel behaviour.
|
||||||
//
|
//
|
||||||
wxString value = GetValue();
|
wxString value = GetValue();
|
||||||
|
int selection = GetSelection();
|
||||||
wxPoint pos = GetPosition();
|
wxPoint pos = GetPosition();
|
||||||
wxSize size = GetSize();
|
wxSize size = GetSize();
|
||||||
size.y = GetBestSize().y;
|
size.y = GetBestSize().y;
|
||||||
@@ -210,6 +211,8 @@ void wxBitmapComboBox::RecreateControl()
|
|||||||
// Revert the old string value
|
// Revert the old string value
|
||||||
if ( !HasFlag(wxCB_READONLY) )
|
if ( !HasFlag(wxCB_READONLY) )
|
||||||
ChangeValue(value);
|
ChangeValue(value);
|
||||||
|
else if ( selection != wxNOT_FOUND )
|
||||||
|
SetSelection(selection);
|
||||||
|
|
||||||
// If disabled we'll have to disable it again after re-creating
|
// If disabled we'll have to disable it again after re-creating
|
||||||
if ( !IsEnabled() )
|
if ( !IsEnabled() )
|
||||||
@@ -407,7 +410,7 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
|
|||||||
|
|
||||||
bool wxBitmapComboBox::OnAddBitmap(const wxBitmap& bitmap)
|
bool wxBitmapComboBox::OnAddBitmap(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
if ( wxBitmapComboBoxBase::OnAddBitmap(bitmap) )
|
if ( wxBitmapComboBoxBase::OnAddBitmap(bitmap) || !GetCount() )
|
||||||
{
|
{
|
||||||
// Need to recreate control for a new measureitem call?
|
// Need to recreate control for a new measureitem call?
|
||||||
int prevItemHeight = ::SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);
|
int prevItemHeight = ::SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);
|
||||||
|
Reference in New Issue
Block a user