]> git.saurik.com Git - wxWidgets.git/commitdiff
Update the value of read-only wxComboBox in wxUniv.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 27 Dec 2011 01:21:46 +0000 (01:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 27 Dec 2011 01:21:46 +0000 (01:21 +0000)
Fix regression in combobox appearance: it never showed the selected value when
it was read-only any more.

Closes #13688.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70126 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/univ/combobox.cpp

index c32ef0534cc19996174af0103d88e6497d862857..a4cc9f2f3ac2b41cad0ab0b64d3b6dacfb4e04c1 100644 (file)
@@ -473,6 +473,11 @@ OSX:
 
 - Provide native implementations of wxDatePickerCtrl and wxTimePickerCtrl.
 
+Univ:
+
+- Fix regression with read-only wxComboBox appearance (Jason Erb).
+
+
 
 2.9.3: (released 2011-12-14)
 ------
index 0cfcbcdd71bdd17a00901c79f254633e1b55c239..e41adaa761e10f5d999827268cf571f0e0996805 100644 (file)
@@ -273,13 +273,15 @@ wxComboBox::~wxComboBox()
 
 wxString wxComboBox::DoGetValue() const
 {
-    return GetTextCtrl() ? GetTextCtrl()->GetValue() : wxString();
+    return GetTextCtrl() ? GetTextCtrl()->GetValue() : m_valueString;
 }
 
 void wxComboBox::SetValue(const wxString& value)
 {
     if ( GetTextCtrl() )
         GetTextCtrl()->SetValue(value);
+    else
+        m_valueString = value;
 }
 
 void wxComboBox::WriteText(const wxString& value)
@@ -358,7 +360,7 @@ void wxComboBox::SetEditable(bool editable)
 void wxComboBox::DoClear()
 {
     GetLBox()->Clear();
-    if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString);
+    SetValue(wxEmptyString);
 }
 
 void wxComboBox::DoDeleteOneItem(unsigned int n)
@@ -366,7 +368,7 @@ void wxComboBox::DoDeleteOneItem(unsigned int n)
     wxCHECK_RET( IsValid(n), wxT("invalid index in wxComboBox::Delete") );
 
     if (GetSelection() == (int)n)
-        if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString);
+        SetValue(wxEmptyString);
 
     GetLBox()->Delete(n);
 }