X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0104114590256337b35eafcb544c650a30ce51f4..44cd54c24e77f6cdf4003156a3d6809e2dd97483:/src/gtk1/textctrl.cpp diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 64c069e006..6194b622bc 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -14,6 +14,7 @@ #include "wx/textctrl.h" #include "wx/utils.h" #include "wx/intl.h" +#include "wx/log.h" #include "wx/settings.h" #include @@ -646,6 +647,14 @@ void wxTextCtrl::SetSelection( long from, long to ) { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + if ( (m_windowStyle & wxTE_MULTILINE) && + !GTK_TEXT(m_text)->line_start_cache ) + { + // tell the programmer that it didn't work + wxLogDebug(_T("Can't call SetSelection() before realizing the control")); + return; + } + gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to ); }