diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 8b10682e5f..2aeb1e00f9 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -443,16 +443,20 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_notebook->AddPage(panel, "wxComboBox", FALSE, Image_Combo); panel = new wxPanel(m_notebook); - m_textentry = new MyTextCtrl( panel, -1, "Write text here.", wxPoint(10,10), wxSize(320,28), + m_textentry = new MyTextCtrl( panel, -1, "Some text.", wxPoint(10,10), wxSize(320,28), //0); wxTE_PROCESS_ENTER); - (*m_textentry) << " More text."; // this text is appended + (*m_textentry) << " Appended."; m_textentry->SetInsertionPoint(0); - m_textentry->WriteText("Less text."); // this text is prepended + m_textentry->WriteText( "Prepended. " ); - m_multitext = new MyTextCtrl( panel, ID_TEXT, "And here.", wxPoint(10,50), wxSize(320,70), + m_multitext = new MyTextCtrl( panel, ID_TEXT, "Some text.", wxPoint(10,50), wxSize(320,70), wxTE_MULTILINE ); - (*m_multitext) << " More text.\nPress function keys to test different \nwxTextCtrl functions."; + (*m_multitext) << " Appended."; + m_multitext->SetInsertionPoint(0); + m_multitext->WriteText( "Prepended. " ); + m_multitext->AppendText( "\nPress function keys to test different \nwxTextCtrl functions." ); + new MyTextCtrl( panel, -1, "This one is with wxTE_PROCESS_TAB style.", wxPoint(10,120), wxSize(320,70), wxTE_MULTILINE | wxTE_PROCESS_TAB); diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index d0808503e7..765f3912be 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -172,7 +172,7 @@ wxSize wxRadioBox::LayoutItems() if (len > max_len) max_len = len; gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y ); - y += 22; + y += 20; node = node->Next(); if (!node) break; @@ -185,7 +185,7 @@ wxSize wxRadioBox::LayoutItems() { GtkWidget *button = GTK_WIDGET( node->Data() ); - gtk_widget_set_usize( button, max_len, 22 ); + gtk_widget_set_usize( button, max_len, 20 ); node = node->Next(); if (!node) break; diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 4f221beeff..538735085e 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -293,19 +293,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 +322,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 +588,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; } } diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index d0808503e7..765f3912be 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -172,7 +172,7 @@ wxSize wxRadioBox::LayoutItems() if (len > max_len) max_len = len; gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y ); - y += 22; + y += 20; node = node->Next(); if (!node) break; @@ -185,7 +185,7 @@ wxSize wxRadioBox::LayoutItems() { GtkWidget *button = GTK_WIDGET( node->Data() ); - gtk_widget_set_usize( button, max_len, 22 ); + gtk_widget_set_usize( button, max_len, 20 ); node = node->Next(); if (!node) break; diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 4f221beeff..538735085e 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -293,19 +293,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 +322,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 +588,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; } }