Re: Scrolling to end of scrolled window when first displayed



2008/5/14 John M Collins <jmc xisl com>:
I have a GtkTextView displaying some text - actually a log file in a
Scrolled Window.

I should like it to start off with the scroll at the bottom of the file
- i.e. showing the most recent entry in the log file.

How do I do this?

I have tried:

gtk_text_buffer_get_end_iter(textbuf, &iter);
gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(view), &iter, 0.0, FALSE,
0.0, 1.0);

But neither work initially - however they do work in callbacks once the
window is up and running.

I found gtk_text_view_scroll_to_mark() worked even when the window was
unmapped. Something like:

        gtk_text_buffer_get_end_iter( text_buffer, &iter );
        gtk_text_buffer_move_mark( text_buffer, mark, &iter );
        gtk_text_view_scroll_to_mark( text_view, mark,
                0.0, TRUE, 0.5, 1 );

John



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