// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
return false;
wxASSERT_MSG( !(style & wxCB_SORT),
"wxCB_SORT not currently supported by wxOSX/Cocoa");
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
return false;
wxASSERT_MSG( !(style & wxCB_SORT),
"wxCB_SORT not currently supported by wxOSX/Cocoa");
- m_peer = wxWidgetImpl::CreateComboBox( this, parent, id, NULL, pos, size, style, GetExtraStyle() );
+ SetPeer(wxWidgetImpl::CreateComboBox( this, parent, id, NULL, pos, size, style, GetExtraStyle() ));
AssignNewItemClientData(idx, clientData, i, type);
}
AssignNewItemClientData(idx, clientData, i, type);
}
// ----------------------------------------------------------------------------
void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData)
{
// ----------------------------------------------------------------------------
void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData)
{
- Delete(n);
- Insert(s, n);
+ // Notice that we shouldn't delete and insert the item in this control
+ // itself as this would also affect the client data which we need to
+ // preserve here.
+ GetComboPeer()->RemoveItem(n);
+ GetComboPeer()->InsertItem(n, s);
{
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
event.SetInt(GetSelection());
{
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
event.SetInt(GetSelection());