X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96ed08f775635ccf57ef797008b05427dfaabcc3..6ba5438dda164146bf36ca729f8328332fae36b7:/samples/listbox/lboxtest.cpp?ds=sidebyside diff --git a/samples/listbox/lboxtest.cpp b/samples/listbox/lboxtest.cpp index 143972d8c2..8f92c1920a 100644 --- a/samples/listbox/lboxtest.cpp +++ b/samples/listbox/lboxtest.cpp @@ -521,6 +521,7 @@ void LboxTestFrame::Reset() void LboxTestFrame::CreateLbox() { + wxWindow *parent = m_lbox->GetParent(); int flags = 0; switch ( m_radioSelMode->GetSelection() ) { @@ -540,19 +541,16 @@ void LboxTestFrame::CreateLbox() flags |= wxLB_SORT; wxArrayString items; - if ( m_lbox ) + int count = m_lbox->GetCount(); + for ( int n = 0; n < count; n++ ) { - int count = m_lbox->GetCount(); - for ( int n = 0; n < count; n++ ) - { - items.Add(m_lbox->GetString(n)); - } - - m_sizerLbox->Detach(m_lbox); - delete m_lbox; + items.Add(m_lbox->GetString(n)); } - m_lbox = new wxListBox(this, wxID_ANY, + m_sizerLbox->Detach(m_lbox); + delete m_lbox; + + m_lbox = new wxListBox(parent, LboxTest_Listbox, wxDefaultPosition, wxDefaultSize, 0, NULL, flags);