diff --git a/include/wx/osx/combobox.h b/include/wx/osx/combobox.h index 05c14a96aa..e3c14f8ad0 100644 --- a/include/wx/osx/combobox.h +++ b/include/wx/osx/combobox.h @@ -104,10 +104,10 @@ class WXDLLIMPEXP_CORE wxComboBox : virtual unsigned int GetCount() const; + virtual void SetValue(const wxString& value); // these methods are provided by wxTextEntry for the native impl. #if wxOSX_USE_CARBON // Text field functions - virtual void SetValue(const wxString& value); virtual wxString GetValue() const; virtual void WriteText(const wxString& text); diff --git a/src/osx/combobox_osx.cpp b/src/osx/combobox_osx.cpp index 762d575df1..3487ef9b17 100644 --- a/src/osx/combobox_osx.cpp +++ b/src/osx/combobox_osx.cpp @@ -189,6 +189,14 @@ wxString wxComboBox::GetStringSelection() const return sel == wxNOT_FOUND ? wxString() : GetString(sel); } +void wxComboBox::SetValue(const wxString& value) +{ + if ( HasFlag(wxCB_READONLY) ) + SetStringSelection( value ) ; + else + wxTextEntry::SetValue( value ); +} + void wxComboBox::SetString(unsigned int n, const wxString& s) { // Notice that we shouldn't delete and insert the item in this control