]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/combobox.cpp
add wxMBConvStrictUTF8 class implementing just UTF-8 conversion, without support...
[wxWidgets.git] / src / univ / combobox.cpp
index 28ae78ee6d4f6d545a0af13498fc1be5da241cd9..f347cfe1b97082e25b9b7ae5489365306bf2368d 100644 (file)
@@ -122,8 +122,8 @@ bool wxComboListBox::Create(wxWindow* parent)
     if ( !wxListBox::Create(parent, wxID_ANY,
                             wxDefaultPosition, wxDefaultSize,
                             0, NULL,
-                            wxBORDER_SIMPLE | wxLB_INT_HEIGHT |
-                            m_combo->GetWindowStyle() & wxCB_SORT ? wxLB_SORT : 0) )
+                            wxBORDER_SIMPLE |
+                            ( m_combo->GetWindowStyle() & wxCB_SORT ? wxLB_SORT : 0 ) ) )
         return false;
 
     // we don't react to the mouse events outside the window at all
@@ -145,9 +145,9 @@ void wxComboListBox::SetStringValue(const wxString& value)
 {
     if ( !value.empty() )
     {
-               if (FindString(value) != wxNOT_FOUND)
-               wxListBox::SetStringSelection(value);
-       }
+        if (FindString(value) != wxNOT_FOUND)
+            wxListBox::SetStringSelection(value);
+    }
     else
         wxListBox::SetSelection(-1);
 }
@@ -386,10 +386,15 @@ int wxComboBox::FindString(const wxString& s, bool bCase) const
 
 void wxComboBox::SetSelection(int n)
 {
-    wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::Select") );
+    wxCHECK_RET( (n == wxNOT_FOUND || IsValid(n)), _T("invalid index in wxComboBox::Select") );
 
     GetLBox()->SetSelection(n);
-    if ( GetTextCtrl() ) GetTextCtrl()->SetValue(GetLBox()->GetString(n));
+
+    wxString str;
+    if ( n != wxNOT_FOUND )
+        str = GetLBox()->GetString(n);
+
+    SetText(str);
 }
 
 int wxComboBox::GetSelection() const