OSX: Fixes for readonly text fields (#2049)

This commit is contained in:
Ian McInerney
2020-09-15 07:21:47 +01:00
committed by GitHub
parent e88f248e3a
commit cb04c35365
2 changed files with 19 additions and 6 deletions

View File

@@ -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;
}

View File

@@ -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