In gtkmm I use:
info_display->insert(info_display->end(), msg);
/* scroll to the end */ info_display->move_mark(info_display->get_insert(), info_display->end()); textView.scroll_to_mark(info_display->get_insert(), 0.0);
With info_display as Glib::RefPtr<Gtk::TextBuffer> and textView as Gtk::TextView.
Just replace with the gtk+ Functions. Hope it helps.
I tried it like this, but it doesn't scroll to the end...
That's bad, here this work as expected. Looks like the same, the only difference I see is that I use GTK_WRAP_NONE for the textview.
Regards, Frank
GtkWidget* textWindow = gtk_text_view_new(); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textWindow), GTK_WRAP_WORD); gtk_text_view_set_editable(GTK_TEXT_VIEW(textWindow), FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textWindow), FALSE);
GtkWidget* scrolledTextWindow = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledTextWindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrolledTextWindow), textWindow);
GtkTextBuffer *buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(textWindow)); GtkTextIter iter; gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert(buffer, &iter, "a\nb\nc\nd\ne\nf\ng\nh\ni\nj", -1);
gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_insert(buffer), &iter); gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textWindow), gtk_text_buffer_get_insert(buffer), 0, FALSE, 0, 0);
_______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list