Fix clearing wxCB_READONLY wxComboBox in wxGTK.

wxComboBox::Clear() must call wxTextEntry::SetValue() explicitly instead of
calling its Clear() which just forwards back to wxComboBox own SetValue(),
which (correctly) doesn't work for read-only comboboxes when passed an empty
string.

Closes #16654.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78085 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-11-01 13:56:30 +00:00
parent 03e64f3c20
commit 844159792f
2 changed files with 7 additions and 1 deletions

View File

@ -91,6 +91,7 @@ wxGTK:
- Support building wxGTK3 under Windows (Kolya Kosenko).
- Fix vertical cell alignment in wxDataViewCtrl.
- Fix clearing of wxComboBox with wxCB_READONLY (Chuddah).
wxMSW:

View File

@ -297,7 +297,12 @@ wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
void wxComboBox::Clear()
{
wxTextEntry::Clear();
// Do not call wxTextEntry::Clear() here as it's implemented in terms of
// virtual SetValue() and so would call our own overridden version of this
// method, which wouldn't do the right thing in wxCB_READONLY case.
//
// Clear the text directly to avoid this.
wxTextEntry::SetValue(wxString());
wxItemContainer::Clear();
}