From 93c2397b68c74750d077c8e9e5bdacc065c04bbc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 26 Apr 2007 02:23:51 +0000 Subject: [PATCH] don't assert in wxUniv SetSelection(wxNOT_FOUND), just clear text zone contents git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45655 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/univ/combobox.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5dde0cbb30..11a1fc9fcb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -129,6 +129,7 @@ wxMac: wxUniv: - Fix wxTextCtrl::SetSelection(-1, -1) to behave as documented (Anders Larsen) +- Fix wxComboBox::SetSelection(wxNOT_FOUND) - Fix setting background colour for controls with transparent background diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index b615a9b537..f347cfe1b9 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -390,7 +390,11 @@ void wxComboBox::SetSelection(int n) GetLBox()->SetSelection(n); - SetText(GetLBox()->GetString(n)); + wxString str; + if ( n != wxNOT_FOUND ) + str = GetLBox()->GetString(n); + + SetText(str); } int wxComboBox::GetSelection() const