From fde8374482bc51ca0539b2db8f449c62a0d0d7e4 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 12 Jun 2013 05:45:35 +0000 Subject: [PATCH 1/1] cocoa needs a special implementation for read-only combo box git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/combobox.h | 2 +- src/osx/combobox_osx.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 -- 2.45.2