From 2c2e0aaa0164368115fc9f2d418e44eac6af74de Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 29 Jul 2017 22:07:42 +0200 Subject: [PATCH] Implement ShowPosition() for single-line wxTextCtrl (wxGTK) --- docs/changes.txt | 1 + src/gtk/textctrl.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 00996fb3d8..a3d4a9a5d0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -163,6 +163,7 @@ wxGTK: - Fix displaying labels of wxRadioBox items. - Add a native implementation for clearing bitmap/window wxGraphicsContexts - Implement XYToPosition() for single-line wxTextCtrl. +- Implement ShowPosition() for single-line wxTextCtrl. wxMSW: diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 7f832eb658..b249f9a076 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1444,6 +1444,11 @@ void wxTextCtrl::ShowPosition( long pos ) else gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(m_text), mark); } + else // single line + { // This function not only shows character at required position + // but also places the cursor at this position. + gtk_editable_set_position(GTK_EDITABLE(m_text), pos); + } } wxTextCtrlHitTestResult