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
This commit is contained in:
Vadim Zeitlin
2011-12-27 01:21:46 +00:00
parent 7eff714407
commit 59060c07b4
2 changed files with 10 additions and 3 deletions

View File

@@ -473,6 +473,11 @@ OSX:
- Provide native implementations of wxDatePickerCtrl and wxTimePickerCtrl. - Provide native implementations of wxDatePickerCtrl and wxTimePickerCtrl.
Univ:
- Fix regression with read-only wxComboBox appearance (Jason Erb).
2.9.3: (released 2011-12-14) 2.9.3: (released 2011-12-14)
------ ------

View File

@@ -273,13 +273,15 @@ wxComboBox::~wxComboBox()
wxString wxComboBox::DoGetValue() const wxString wxComboBox::DoGetValue() const
{ {
return GetTextCtrl() ? GetTextCtrl()->GetValue() : wxString(); return GetTextCtrl() ? GetTextCtrl()->GetValue() : m_valueString;
} }
void wxComboBox::SetValue(const wxString& value) void wxComboBox::SetValue(const wxString& value)
{ {
if ( GetTextCtrl() ) if ( GetTextCtrl() )
GetTextCtrl()->SetValue(value); GetTextCtrl()->SetValue(value);
else
m_valueString = value;
} }
void wxComboBox::WriteText(const wxString& value) void wxComboBox::WriteText(const wxString& value)
@@ -358,7 +360,7 @@ void wxComboBox::SetEditable(bool editable)
void wxComboBox::DoClear() void wxComboBox::DoClear()
{ {
GetLBox()->Clear(); GetLBox()->Clear();
if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString); SetValue(wxEmptyString);
} }
void wxComboBox::DoDeleteOneItem(unsigned int n) 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") ); wxCHECK_RET( IsValid(n), wxT("invalid index in wxComboBox::Delete") );
if (GetSelection() == (int)n) if (GetSelection() == (int)n)
if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString); SetValue(wxEmptyString);
GetLBox()->Delete(n); GetLBox()->Delete(n);
} }