Implement wxTextCtrl::ShowPosition() (wxOSX)

Closes #17811.
This commit is contained in:
Artur Wieczorek
2017-07-22 22:02:55 +02:00
parent d233b8939b
commit 572ec50827
4 changed files with 23 additions and 1 deletions

View File

@@ -933,6 +933,15 @@ long wxNSTextViewControl::XYToPosition(long x, long y) const
return lineRng.location + x;
}
void wxNSTextViewControl::ShowPosition(long pos)
{
if ( !m_textView )
return;
wxCHECK_RET( pos >= 0, wxS("Invalid character position") );
[m_textView scrollRangeToVisible:NSMakeRange(pos, 1)];
}
void wxNSTextViewControl::WriteText(const wxString& str)
{
wxString st = str;
@@ -1246,6 +1255,16 @@ long wxNSTextFieldControl::XYToPosition(long x, long y) const
return x;
}
void wxNSTextFieldControl::ShowPosition(long pos)
{
wxCHECK_RET( pos >= 0, wxS("Invalid character position") );
NSText* editor = [m_textField currentEditor];
if ( editor )
{
[editor scrollRangeToVisible:NSMakeRange(pos, 1)];
}
}
void wxNSTextFieldControl::WriteText(const wxString& str)
{
NSEvent* formerEvent = m_lastKeyDownEvent;