diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 034a4cce4a..980ef79142 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -928,6 +928,12 @@ void wxTextCtrl::SetSelection( long from, long to ) { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + if (from == -1 && to == -1) + { + from = 0; + to = GetValue().Length(); + } + #ifndef __WXGTK20__ if ( (m_windowStyle & wxTE_MULTILINE) && !GTK_TEXT(m_text)->line_start_cache ) diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 034a4cce4a..980ef79142 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -928,6 +928,12 @@ void wxTextCtrl::SetSelection( long from, long to ) { wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + if (from == -1 && to == -1) + { + from = 0; + to = GetValue().Length(); + } + #ifndef __WXGTK20__ if ( (m_windowStyle & wxTE_MULTILINE) && !GTK_TEXT(m_text)->line_start_cache )