X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bac957422a5fb858173f7c0643dd1c0f5ae2d506..d21d2e5adf7a5acf3b496a9c4e87eab220bd75d8:/src/gtk1/listbox.cpp diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 20c77eec98..9cf8883c8e 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -393,8 +393,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_widget_show( GTK_WIDGET(m_list) ); - SetBestSize( size ); - if ( style & wxLB_SORT ) { // this will change DoAppend() behaviour @@ -411,6 +409,10 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, DoAppend(choices[i]); } + // call it after appending the strings to the listbox, otherwise it doesn't + // work correctly + SetBestSize( size ); + m_parent->DoAddChild( this ); PostCreation(); @@ -667,6 +669,12 @@ void wxListBox::Clear() wxCHECK_RET( m_list != NULL, wxT("invalid listbox") ); gtk_list_clear_items( m_list, 0, GetCount() ); + + if ( GTK_LIST(m_list)->last_focus_child != NULL ) + { + // This should be NULL, I think. + GTK_LIST(m_list)->last_focus_child = NULL; + } if ( HasClientObjectData() ) {