From 59060c07b4311cd6db44f5758f133e1cde7bb589 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 27 Dec 2011 01:21:46 +0000 Subject: [PATCH] Update the value of read-only wxComboBox in wxUniv. 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 | 5 +++++ src/univ/combobox.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index c32ef0534c..a4cc9f2f3a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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) ------ diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index 0cfcbcdd71..e41adaa761 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -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); }