Re: GtkTextView and scrolling



Gustavo Joćo Alves Marques Carneiro <ee96090 fe up pt> writes:
>   I'm struggling to have a simple GtkTextView scroll all the way to
> bottom. I have a function that inserts some text into a text buffer, at
> the end, and then scrolls the view all the way down. Just like a terminal
> emulation program.
>   I have tried 3 approaches:
>     1- Manually setting the value of the containing scrolled window:
> 	gtk_adjustment_set_value(adj, adj->upper - adj->page_size);
>        This used to work with GtkText in gtk-1.2
>     2- gtk_text_view_scroll_to_iter()
>     3- gtk_text_view_scroll_to_mark()
> 
>   All three methods succeed when text being inserted is a single line, but
> when the inserted text has more than one line, only the first one is
> displayed. The rest of the lines are below, outside the view.
> 

To scroll to the end it should work to just:
 gtk_text_buffer_get_end_iter (buffer, &iter);
 gtk_text_view_scroll_to_iter (textview, &iter, 0, TRUE, 0.0, 1.0);

If that doesn't work, toss us a bug report on bugzilla.gnome.org -
maybe include the exact code you're using.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]