Ignore non-existant string selection in wxComboBox::SetValue() in read-only mode, as per the very exact docs, fixes #12329: wxComboBox can set non-existing string in read only mode

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2010-08-16 17:48:28 +00:00
parent bdf90a1a1c
commit 9572bf1d44
2 changed files with 10 additions and 0 deletions

View File

@ -101,6 +101,8 @@ public:
void OnChar( wxKeyEvent &event );
virtual void SetValue(const wxString& value);
// Standard event handling
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);

View File

@ -276,6 +276,14 @@ wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return GetDefaultAttributesFromGTKWidget(gtk_combo_box_entry_new, true);
}
void wxComboBox::SetValue(const wxString& value)
{
if ( HasFlag(wxCB_READONLY) )
SetStringSelection(value);
else
wxTextEntry::SetValue(value);
}
// ----------------------------------------------------------------------------
// standard event handling
// ----------------------------------------------------------------------------