X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a6e2157322eedc8142be3a24cb3fe26eb1e8a0e8..bb0ca8dfccd978b4b2545cffe7ffeda28e368142:/src/gtk1/textctrl.cpp?ds=sidebyside diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 4f221beeff..d7f0dcd96e 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -127,6 +127,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, // ... and put into the upper left hand corner of the table m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE); + GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); + gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK), (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK), @@ -136,6 +138,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, if (bHasHScrollbar) { GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj); + GTK_WIDGET_UNSET_FLAGS( hscrollbar, GTK_CAN_FOCUS ); + gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, @@ -145,6 +149,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, // finally, put the vertical scrollbar in the upper right corner m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj ); + GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS ); + gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1, GTK_FILL, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), @@ -293,19 +299,23 @@ void wxTextCtrl::WriteText( const wxString &text ) if (m_windowStyle & wxTE_MULTILINE) { /* this moves the cursor pos to behind the inserted text */ - gint len = GTK_EDITABLE(m_text)->current_pos; - gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); /* bring editable's cursor uptodate. bug in GTK. */ - GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) ); - } else { - gtk_entry_append_text( GTK_ENTRY(m_text), text ); + /* this moves the cursor pos to behind the inserted text */ + gint len = GTK_EDITABLE(m_text)->current_pos; + gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); + + /* bring editable's cursor uptodate. bug in GTK. */ + GTK_EDITABLE(m_text)->current_pos += text.Len(); + + /* bring entry's cursor uptodate. bug in GTK. */ + gtk_entry_set_position( GTK_ENTRY(m_text), GTK_EDITABLE(m_text)->current_pos ); } } @@ -318,6 +328,8 @@ void wxTextCtrl::AppendText( const wxString &text ) /* we'll insert at the last position */ gint len = gtk_text_get_length( GTK_TEXT(m_text) ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len ); + + /* bring editable's cursor uptodate. bug in GTK. */ GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) ); } else @@ -582,6 +594,10 @@ void wxTextCtrl::SetInsertionPoint( long pos ) else { gtk_entry_set_position( GTK_ENTRY(m_text), (int)pos ); + + /* bring editable's cursor uptodate. bug in GTK. */ + + GTK_EDITABLE(m_text)->current_pos = pos; } }