This fixes the calculation of the initial best size as previously the default
value was not updated even if longer strings were added later.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72847
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxArrayString m_strings;
wxChoiceDataArray m_datas ;
wxMenu* m_popUpMenu ;
wxArrayString m_strings;
wxChoiceDataArray m_datas ;
wxMenu* m_popUpMenu ;
+
+private:
+ // This should be called when the number of items in the control changes.
+ void DoAfterItemCountChange();
// adding/deleting items to/from the list
// ----------------------------------------------------------------------------
// adding/deleting items to/from the list
// ----------------------------------------------------------------------------
+void wxChoice::DoAfterItemCountChange()
+{
+ InvalidateBestSize();
+
+ GetPeer()->SetMaximum( GetCount() );
+}
+
int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos,
void **clientData, wxClientDataType type)
int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos,
void **clientData, wxClientDataType type)
AssignNewItemClientData(idx, clientData, i, type);
}
AssignNewItemClientData(idx, clientData, i, type);
}
- GetPeer()->SetMaximum( GetCount() );
+ DoAfterItemCountChange();
m_strings.RemoveAt( n ) ;
m_datas.RemoveAt( n ) ;
m_strings.RemoveAt( n ) ;
m_datas.RemoveAt( n ) ;
- GetPeer()->SetMaximum( GetCount() ) ;
+ DoAfterItemCountChange();
}
void wxChoice::DoClear()
}
void wxChoice::DoClear()
m_strings.Empty() ;
m_datas.Empty() ;
m_strings.Empty() ;
m_datas.Empty() ;
- GetPeer()->SetMaximum( 0 ) ;
+ DoAfterItemCountChange();
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------