diff --git a/src/osx/cocoa/combobox.mm b/src/osx/cocoa/combobox.mm index dd68132ae5..7fc69b1276 100644 --- a/src/osx/cocoa/combobox.mm +++ b/src/osx/cocoa/combobox.mm @@ -330,11 +330,11 @@ void wxNSComboBoxControl::Dismiss() void wxNSComboBoxControl::SetEditable(bool editable) { - // TODO: unfortunately this does not work, setEditable just means the same as CB_READONLY - // I don't see a way to access the text field directly - - // Behavior NONE <- SELECTECTABLE [m_comboBox setEditable:editable]; + + // When the combobox isn't editable, make sure it is still selectable so the text can be copied + if ( !editable ) + [m_comboBox setSelectable:YES]; } wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxComboBox* wxpeer, @@ -352,9 +352,12 @@ wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxComboBox* wxpeer, [v setNumberOfVisibleItems:999]; else [v setNumberOfVisibleItems:13]; - if (style & wxCB_READONLY) - [v setEditable:NO]; + wxNSComboBoxControl* c = new wxNSComboBoxControl( wxpeer, v ); + + if (style & wxCB_READONLY) + c->SetEditable(false); + return c; } diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index 3029096b03..c1d18b5589 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -844,7 +844,13 @@ bool wxNSTextViewControl::CanPaste() const void wxNSTextViewControl::SetEditable(bool editable) { if (m_textView) + { [m_textView setEditable: editable]; + + // When the field isn't editable, make sure it is still selectable so the text can be copied + if ( !editable ) + [m_textView setSelectable:YES]; + } } long wxNSTextViewControl::GetLastPosition() const @@ -1374,6 +1380,10 @@ bool wxNSTextFieldControl::CanPaste() const void wxNSTextFieldControl::SetEditable(bool editable) { [m_textField setEditable:editable]; + + // When the field isn't editable, make sure it is still selectable so the text can be copied + if ( !editable ) + [m_textField setSelectable:YES]; } long wxNSTextFieldControl::GetLastPosition() const